Question: Program Specification: Write a Java program that emulates a simple binary calculator: Declare and initialize a String variable ( bitString ) to Declare

Program Specification:
Write a Java program that emulates a simple binary calculator:
Declare and initialize a String variable (bitString) to ""
Declare and initialize an int variable (resultSoFar) to 0
Display the current expression to the screen
Repeat the following until the (Exit ) option is selected:
Display a menu which gives the user the choice of the following menu options:
0 Shift Left, Add 0
1 Shift Left, Add 1
2-> Exit, Evaluate
and uses a user validation loop to read their response into a String variable.
Note: You must repeatedly get the users response until it is exactly one of the characters 012
If (Exit) was NOT selected:
(a) Update the (bitString) string:
Add the selected operation string to the end of (bitString) : ''0"' or +'"1"'
(b) Display the current bitstring to the screen
(c) Update the numeric result of the bitstring (resultSoFar) :
resultSoFar =2** resultSoFar +0 or resultSoFar =2** resultSoFar +1
Display the entire expression with its result.
Grading:
\table[[Performance Indicator,1,2,3
 Program Specification: Write a Java program that emulates a simple binary

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 Databases Questions!