5. Finally, output the result to the user and ask the user if he/she wants to start over. Sample Output: Do you want to start over? (Y/N) Y Full Sample Output: Enter the calculator mode: Standard/Scientific? Scientific Enter + for addition, for subtractions, for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: addition Invalid operator addition Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: How many numbers do you want to add?: Enter 3 numbers: 3 4 35 9 Y Scientific Result: 48.0 Do you want to start over? (Y/N) Enter the calculator mode: Standard/Scientific? Enter + for addition, '' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: COS 0 N Enter a number in radians to find the cosine Result: 1 Do you want to start over? (Y/N) Goodbye

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Need help to make a calculator in coding with Java.

5. Finally, output the result to the user and ask the user if he/she wants to start over.
Sample Output:
Do you want to start over? (Y/N)
Y
Full Sample Output:
Enter the calculator mode: Standard/Scientific?
Scientific
Enter
for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
addition
Invalid operator addition
Enter for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
+
How many numbers do you want to add?:
3
35
9
Y
Enter 3 numbers:
0
Result: 48.0
Do you want to start over? (Y/N)
Scientific
N
Enter the calculator mode: Standard/Scientific?
Enter '+' for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
cos
Enter a number in radians to find the cosine
Result: 1
Do you want to start over? (Y/N)
Goodbye
Transcribed Image Text:5. Finally, output the result to the user and ask the user if he/she wants to start over. Sample Output: Do you want to start over? (Y/N) Y Full Sample Output: Enter the calculator mode: Standard/Scientific? Scientific Enter for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: addition Invalid operator addition Enter for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: + How many numbers do you want to add?: 3 35 9 Y Enter 3 numbers: 0 Result: 48.0 Do you want to start over? (Y/N) Scientific N Enter the calculator mode: Standard/Scientific? Enter '+' for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: cos Enter a number in radians to find the cosine Result: 1 Do you want to start over? (Y/N) Goodbye
1. The calculator program will first ask the user for the mode to operate in (Standard or Scientific)
Scientific
Sample Output:
Enter the calculator mode: Standard/Scientific?
2. The program should then ask the user for the operation to execute (+,-, *, /, sin x, cos x, tan
x)
Sample Output
for Scientific mode:
Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
sin
Sample Output for Standard mode:
The calculator will operate in standard mode.
Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division
2a. If the user enters an invalid operator, output a message telling the user the input is invalid
and re-prompt the user for the operation again.
Sample Output for Scientific mode:
Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
division
Invalid operator division
Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin'
for sin x, 'cos' for cos x, 'tan' for tan x:
3
3. In order to know how many times the user will need to perform the operation, prompt the user for
the number of floating point values they want to enter (All numbers in this program are double), then
ask the user to enter the numbers.
35
9
Sample Output:
How many numbers do you want to add?:
Enter 3 numbers:
In this example the calculator will calculate 4 + 35+ 9. The calculated result will be 48.
The calculator should be able to perform the following operations:
2+3 = 5
2+6+1+1+1 = 11
1-2-90-91
10*2*3 = 60
10/2/5 = 1
cos (0)
1
sin (0)
0
tan (0) 0
Note: This calculator does NOT support multiple operations of varying operators in the expressions
like: 10+2-8
Note: Multiple numbers are only acceptable for the operations of (+,-, *, / ) not for (sin, cos, tan)
4. Display the result
Sample Output:
Result: 50.0
Transcribed Image Text:1. The calculator program will first ask the user for the mode to operate in (Standard or Scientific) Scientific Sample Output: Enter the calculator mode: Standard/Scientific? 2. The program should then ask the user for the operation to execute (+,-, *, /, sin x, cos x, tan x) Sample Output for Scientific mode: Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: sin Sample Output for Standard mode: The calculator will operate in standard mode. Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division 2a. If the user enters an invalid operator, output a message telling the user the input is invalid and re-prompt the user for the operation again. Sample Output for Scientific mode: Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: division Invalid operator division Enter + for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x, 'tan' for tan x: 3 3. In order to know how many times the user will need to perform the operation, prompt the user for the number of floating point values they want to enter (All numbers in this program are double), then ask the user to enter the numbers. 35 9 Sample Output: How many numbers do you want to add?: Enter 3 numbers: In this example the calculator will calculate 4 + 35+ 9. The calculated result will be 48. The calculator should be able to perform the following operations: 2+3 = 5 2+6+1+1+1 = 11 1-2-90-91 10*2*3 = 60 10/2/5 = 1 cos (0) 1 sin (0) 0 tan (0) 0 Note: This calculator does NOT support multiple operations of varying operators in the expressions like: 10+2-8 Note: Multiple numbers are only acceptable for the operations of (+,-, *, / ) not for (sin, cos, tan) 4. Display the result Sample Output: Result: 50.0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education