Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago