Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Besides the minimal functions (+, -, *, /, decimals, ^, and errors) you only have to add one other function from the Suggested functions. *Zoom

image text in transcribed

Besides the minimal functions (+, -, *, /, decimals, ^, and errors) you only have to add one other function from the Suggested functions.

*Zoom in or save image if it is too difficult to see

Project: Calculator Author: Graham Mitchell Filename: Calculator.java Write a calculator program. A minimal calculator will support the following functions: numbers with decimals (not just integers) addition (1 + 2 is 3) subtraction (12 - 4 is 8) multiplication (33 * 2 is 66) division (3 / 8 is 0.375) exponents (2^3 is 8) error messages when you do something wrong Your calculator should keep on running until explicitly told to quit. I suggest typing a zero as the first operand to cause it to quit, i.e. >2 + 3 5 >4 * 9 36 >0 + 2 Bye, now. Programs may support other features if desired. Suggested other functions to add include: modulus (10 % 3 is 1) factorials (4 ! is 4*3*2*1, a.k.a. 24) trigonometric functions (sin,cos, tan) square roots negation (- -3 is 3) angles in degrees or radians a help feature to display legal syntax and supported functions previous result used as first operand the ability to store and recall results rounding logarithms arbitrary roots conversion from base 10 to binary (for integers only) Interested students might look at the documentation for java.lang.Math to find help with some of the above functions. Also, some may wonder how to deal with the first operand possibly being a character or a number. That is, how can your program support phrases like "2 + 3" (double String double) and "sin 30" (String double) at the same time? Well, if you read in everything as a String, then I've written some functions you can use convert to other things. Numeric.java Numeric.isNumeric( String 3) // returns true if s is a number Numeric.isInteger ( String 3) // returns true if s is an integer Numeric.isDouble ( String 3) // returns true if s is a double Double.valueOf( String 3) // returns the double that s represents Integer.valueof ( String 3) // returns the int that s represents

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

=+What is your maiden name?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago