Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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: ||
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY