LabProgram.java 1 import java.util.Scanner; e output a 3 public class LabProgram { public static void main(String[] args) { Scanner sc = new Scanner(System.in); 5 differs. See highlights below....

There is something wrong with my code It prints more than one line of code help me get my expected output please I’m using Java for this oneLabProgram.java<br>1 import java.util.Scanner;<br>e output a<br>3 public class LabProgram {<br>public static void main(String[] args) {<br>Scanner sc = new Scanner(System.in);<br>5<br>differs. See highlights below.<br>Special character legen<br>7.<br>String sentence= sc.nextLine();<br>String newSentence=

Extracted text: LabProgram.java 1 import java.util.Scanner; e output a 3 public class LabProgram { public static void main(String[] args) { Scanner sc = new Scanner(System.in); 5 differs. See highlights below. Special character legen 7. String sentence= sc.nextLine(); String newSentence=""; int character = sentence.length(); 9. Input -Hello, 1 world$! 10 11 12 for (int i = 0; i < character;="" i++)="" {="" 13="" he="" 14="" if="" (sentence.charat(i)="" '1')="" {="" 15="" newsentence="" +="" ;="" 16="" hee="" 17="" hele="" 18="" else="" if="" (sentence.charat(i)="=" 19="" newsentence="" +="" :="" }="" }="" (,$.="" helle="" 20="" 21="" helloe="" hello,="" e="" 22="" else="" if="" (sentence.charat(i)="=" '="" ')="" {="" newsentence="" +="" ;="" 23="" 24="" hello,="" e="" 25="" 26="" your="" output="" hello,="" e="" else="" if="" (sentence.charat(i)="=" '.')="" {="" newsentence="" +="" ;="" 27="" 28="" hello,="" e="" hello,we="" 29="" 30="" else="" if="" (sentence.charat(i)="=" '@')="" {="" newsentence="" +="" ;="" 31="" hello,wod="" 32="" 33="" hello,word="" hello,world="" 34="" else="" if="" (sentence.charat(i)="=" '-')="" {="" newsentence="" +="" ;="" 35="" 36="" 37="" hello,world="" 38="" else="" if="" (sentence.charat(i)="=" '!')="" {="" 39="" hello,worlde="" newsentence="" +="" ;="" }="" 40="" hello,worlde="" 41="" 42="" else="" {="" newsentence="" +="sentence.charAt(i);" 43="" 44="" pected="" output="" helloworld="" 45="" 46="" system.out.println(newsentence);="" 47="" 48="" 49="" 50="" re="" output="" a="">
4.20 LAB: Remove all non alpha characters<br>Write a program that removes all non alpha characters from the given input.<br>Ex: If the input is:<br>-Hello, 1 world$!<br>the output is:<br>Helloworld<br>354532.2042412.qx3zgy7<br>

Extracted text: 4.20 LAB: Remove all non alpha characters Write a program that removes all non alpha characters from the given input. Ex: If the input is: -Hello, 1 world$! the output is: Helloworld 354532.2042412.qx3zgy7

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here