Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started