Question: Instructions Prompt the user to enter a String and then ask whether to display even or odds (O for even, 1 for odd). Create a

 Instructions Prompt the user to enter a String and then askwhether to display even or odds (O for even, 1 for odd).

Instructions Prompt the user to enter a String and then ask whether to display even or odds (O for even, 1 for odd). Create a method showTable that receives a String sText and a boolean bEven as parameters. This method should display a table with the ASCII code of each character of the String. If bEven is true, add an asterisk (*) to the right of each even code. Otherwise, add an asterisk to the right of each odd code. Name your program CodeParityXYZ.java (replace XYZ by your first and last name). Submit your Java file. No other file types will be accepted. Hint: to find the ascii code of a char, you need to cast it into an int type as shown below char ch = 'a'; int ascii = ch; // cast ch into to an int datatype to obtain the ascii code int castAscii = (int) ch; Enter text: United States of America Enter parity (0=even, 1=odd) : 1 Char Code U 85* n 110 O 105* t 116 e 101* d 100 32 S 83* t 116 a 97* t 116 e 101* S 115* 32 O 111* f 102 32 A 65* m 109* e 101* 114 105* C 99* a 97*

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!