Harvey B.

asked • 05/24/21

Java code needed

Java code needed! someone please help me with this code!

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. The output should include the input character and use the plural form, n's if the number of times the characters appear is not exactly 1.


Ex: If the input is:


n Monday

the output is:


1 n

Ex: If the input is:


z Today is Monday

the output is:


0 z's

Ex: If the input is:


n It's a sunny day

the output is:


2 n's

Case matters.


Ex: If the input is:


n Nobody

the output is:


0 n's

n is different than N.

1 Expert Answer

By:

Patrick B. answered • 05/24/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Harvey B.

It does not work, this is the template for the code import java.util.Scanner; public class LabProgram { public static void main(String[] args) { /* Type your code here. */ } }
Report

05/24/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.