Java Programming: Enter a sentence, tells you if each letter is Upper or lower c

timer Asked: Jun 19th, 2013

Question description

So this is what I must have...

Write a program that prompts user to enter a sentence. The program should display each character on the screen except space character (‘ ‘). For each character, there are three possible outputs to display; "Upper case", "Lower case", and "Not a letter". Note that if the character is a space character, then you do not display space character, and you do not display any of the three possible outputs. Also there must not be a blank line. The program also must show total letter count, total lower case count, and total upper case count. For the total letter count, do not include the space characters, or Non-letter characters.

You must write two classes; LetterCase and LetterCounter.

LetterCase class must have the following;

isThisSpace : Takes a char parameter, returns true if the parameter is a space character.

isThisUpperCase : Takes a char parameter, returns true if the parameter is upper case.

isThisLowerCase : Takes a char parameter, returns true if the parameter is lower case.

main : You must create a LetterCounter object in main method. Read in a sentence from the user. To iterate the characters of the sentence, you must use for loop. In each iteration, call the boolean methods above. Then change the status of the counter if necessary. Then display the letter counts.

LetterCounter class must have the following;

Default constructor.

getUpperCount : returns uppercase count (int). Make this method private.

getLowerCount : returns lowercase count (int). Make this method private.

increaseUpperCount : increases by one.

increaseLowerCount : increases by one.

displayCounts: displays three lines as in the screenshot. Call getUpperCount and getLowerCount methods.

And the required output.


Tutor Answer

(Top Tutor) Studypool Tutor
School: UCLA
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors