Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. How do firms identify and develop new-product opportunities?

Answered: 1 week ago

Question

Write the properties of Group theory.

Answered: 1 week ago

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago