Write a console calculator app in Java for your friend Chavvi called ChavviCalc to demonstrate that you can help her. Maybe one day you’ll turn your ChavviCalc into an iPhone app, make a million dollars, and help your friend too!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
  • Write a console calculator app in Java for your friend Chavvi called ChavviCalc to demonstrate that you can help her.  Maybe one day you’ll turn your ChavviCalc into an iPhone app, make a million dollars, and help your friend too!

 

  • Your friend Chavvi is allowed to type in anything.  But, your app is resilient.  So, it only accepts valid input.
  • Your app also prints friendly and appropriate error messages when invalid information is typed in.
    • Valid input is the single character menu commands like a, b, +, -, /, *, =, c, or q.
    • For numerical values for A and B, valid input is an integer or floating-point value having maximum numerical precision (Links to an external site.) of floats in Java.  In other words, students only need to use floats to store numerical values.
    • Entering a non-numerical value for a number prints an error message.
    • Dividing by 0 prints an error message.
    • To enter commands or numbers, the user types in a command or number, and then presses enter.
  • Menu Command

    Description of functionality

    a

    Asks the user to enter a number for A

    b

    Asks the user to enter a number for B

    +

    A gets the value of A plus B. In other words, A = A + B

    -

    A gets the value of A minus B. In other words, A = A - B

    *

    A gets the value of A times B. In other words, A = A * B

    /

    A gets the value of A divided by B. In other words, A = A / B.  Dividing by zero is invalid user input.

    c

    Clears the values for both A and B.  A gets the value 0 and B gets the value 0.

    In other words, A =0, B = 0.

     

    q

    Quits the app

    <None> Initialization

    Upon starting the calculator, the values of A and B are initially set to 0.

Chavvi Calc
A = 0.000
B = 0.000
a
Enter a value for A
b
Enter a value for B
Add
Subtract
Multiply
Divide
Clear
Quit
Enter a command: ||
Transcribed Image Text:Chavvi Calc A = 0.000 B = 0.000 a Enter a value for A b Enter a value for B Add Subtract Multiply Divide Clear Quit Enter a command: ||
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY