Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to convert the user input based on the following specifications. The user input has the following format [variable-length number] [a space] [A|B|H|M]

Write a program to convert the user input based on the following specifications. The user input has the following format

[variable-length number] [a space] [A|B|H|M]

If the input is a number followed by the character "A," output the ASCII representation of (number - 1), (number), and (number +1).

Assume the number to be a 3-digit decimal number. 
If the above assumption is not correct, output "PASS." 

If the input is a number followed by the character "B," output the decimal equivalent.

Assume the number to be a 4-digit binary number. 
If the above assumption is not correct, output "PASS." 

If the input is a number followed by the character "H," output the binary equivalent.

Assume the number to be a 2-digit hexadecimal number. 
If the above assumption is not correct, output "PASS." 

If the input is a number followed by the character "M," output the multiplication of all digits as decimal numbers.

Assume the number to be an one to three (1 ~ 3) digit octal. 
If the above assumption is not correct, output "PASS." 

If none of the above conditions is met, output "Goodbye."

Make sure that you observe the following requirements:

1. You must have at least two (2) "fall through" switch statements in your submission. Use as many "fall through" constructs as possible to simplify your code.

2. Remove as many "magic numbers" as possible -- preferably none -- in your Java code. Your code will be examined closely and graded accordingly.

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago