Question: Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string.
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string.
Ex: If the input is:
n Monday
the output is:
1
Ex: If the input is:
z Today is Monday
the output is:
0
Ex: If the input is:
n It's a sunny day
the output is:
2
Case matters.
Ex: If the input is:
n Nobody
the output is:
0
n is different than N.
What i am given:
import java.util.Scanner;
public class LabProgram { public static void main(String[] args) { /* Type your code here. */ } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
