subject

Programming Project ( Java ) You learned that computers follow instructions faithfully and they never get tired of repeating the same thing over and over. You plan to write a simple program Calculator. java to see for yourself.
After bragging a bit, the program asks the user to enter 2 numbers. After receiving and storing those it asks the user to enter one of the operations +,-, *, or /. The program then performs that operation on the two numbers and displays the output to the user (if the user enters an operation different from the four operations above, the program notifies the user that it does not know that operation). It then brags some more and asks the user if they want to play again. If the user enters Y or y, the game starts over. Otherwise the program prints Bye bye and terminates.
A few sample runs of the program are shown below:
Run 1
Hi, I am really good at math! Put me to the test.
Please enter two numbers and then press Enter: 3 6
Please enter one of the operations +, -, * or / and press Enter: +
3 + 6 = 9
I'm great at addition!
Play again [Y/N]?: N
Bye bye!
Run 2
Hi, I am really good at math! Put me to the test.
Please enter two numbers and then
press Enter: 2.7 0.82
Please enter one of the operations +,-, * or / and press Enter: -
2.7 - 0.82 = 1.88
I'm great at subtraction!
Play again [Y/N]?: N
Bye bye!
Run 3
Hi, I am really good at math! Put me to the test.
Please enter two numbers and then press Enter: 1 3
Please enter one of the operations +,-, * or / and press Enter: /
1 / 3 = 0.333333
I'm great at division!
Play again [Y/N]?: Y
Hi, I am really good at math! Put me to the test.
Please enter two numbers and then press Enter: 3.14 2
Please enter one of the operations +,-, * or / and press Enter: *
3.14 * 2 = 6.28
I'm great at multiplication!
Play again [Y/N]?: y
Hi, I am really good at math! Put me to the test.
Please enter two numbers and then press Enter: 2 3
Please enter one of the operations +,-, * or / and press Enter: $
I can compute really well, but what you entered is not one of the operations I know ...
Play again [Y/N]?: N
Bye bye!
Hints:
– This program is really simple and many of you will find it trivial. The goal of the assignment is for students to get familiar with their development tool, basic program design and the basic structure of a Java program. You should know almost all of what you need from your CS 50 course.
– The program uses 4 variables, two for the numeric values, one for the operation, and one for playing again or terminating. What type should these variables be?
– To be able to perform a different computation based on the operation entered the program will need to make a choice.
– Write the program initially without the "Play again?" functionality. Once you have that, wrap a loop around it to allow for repeated games.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:10
Linux is distributed under gnu gpl. why is this important? a. it ensures that only torvalds can profit from the sale of linux b. it prevents unknowledgeable users from downloading programs they don't know how to operate. c. it provides protection for the developers who created linux. d. it states that anyone can copy, modify, and share the program if changes are made public.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value.a member function called setscore that accepts a parameter and assigns it to score . the function returns no value.a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Another name for addicting games.com
Answers: 1
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
You know the right answer?
Programming Project ( Java ) You learned that computers follow instructions faithfully and they nev...
Questions
question
Mathematics, 04.02.2020 10:47
question
Mathematics, 04.02.2020 10:47
question
Computers and Technology, 04.02.2020 10:47
Questions on the website: 13722361