Question: 4 . 1 6 LAB: Count characters exactly 1 . Exifthe ingut is: Manday the output is: 1 n Exlfthe inputiz: = Today 1 a
LAB: Count characters exactly
Exifthe ingut is:
Manday
the output is:
n
Exlfthe inputiz:
Today a Monday
the outgut is:
xprime a
Exlfthe inputiz:
a It'a a aunny day
the output is:
mathrmnprimemathrma
Case mattars.
Exlf the ingut is:
D Nohody
the outgut is:
mathrmncdot mathrma
nis dfferant than N
LabProgram.java
Load default template...
Import java.ut:lScarner;
public class Laberogran
public statlic vold rainString args
Scanner Sc now ScannerSystenIn;
Proept and read the character Enput
Char ch scnoxtcharatB; heud the first chanacter
scnertline; Clear the newline chanacter
Proept and read the streling inpurt
String str scnextLine;
Int count ;
Count occurrences of the chanacter in the string
for Int i ; i strlength; i
if strcharAt ch
count;
Output the result with proper pluralization
Systemout.printncount ch count : s;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
