Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that uses the java Math library and implement the functionality

ID: 3636973 • Letter: W

Question

Write a program that uses the java Math library and implement the functionality of a scientific calculator. Your program should have the following components:
1. A main menu listing all the functionality of the calculator.
2. Your program should use the switch structure to switch between various options of the calculator. Your Program should also have the provision to handle invalid option selection by the user.
3. Your calculator SHOULD HAVE the following functionalities. You can add any other additional features. PLEASE MAKE SURE YOU USE APPROPRIATE DATA TYPES.
a. Basic Functionality:
i. Add two numbers.
ii. Subtract two numbers.
iii. Divide a number by the second number (Don’t forget to check for the divide by zero error).
iv. Multiply two numbers.
v. Remainder when a number is divided by the second.
b. Scientific Calculations:
i. Ceiling and Floor of a number.
ii. Sine, Cosine and Tangent of an angle given in radians.
iii. x^2, x^3 and x^y (You can display exponents in your program as x^y).
iv. Square root of a non-negative number (add appropriate checks in your program).
v. Logarithm of x base 10, natural logarithm of x base e and exponential function ex
vi. Absolute value of a given number x.
c. Additional Features: a can be done by using simple arithmetic operators. b can be done using the Math library of java. You have to write code to add the following features to your calculator:
i. Calculate average of arbitrary positive numbers input by the user (Use a loop and an appropriate sentinel value to achieve this task).
ii. Determine if a number is even or odd.
iii. Determine if one number is a multiple of the other.
iv. Factorial of a non-negative integer (you can use code from your previous assignment).

Explanation / Answer

i. Add two numbers. ii. Subtract two numbers. iii. Divide a number by the second number (Don’t forget to check for the divide by zero error). iv. Multiply two numbers. v. Remainder when a number is divided by the second. b. Scientific Calculations: i. Ceiling and Floor of a number. ii. Sine, Cosine and Tangent of an angle given in radians. iii. x^2, x^3 and x^y (You can display exponents in your program as x^y). iv. Square root of a non-negative number (add appropriate checks in your program). v. Logarithm of x base 10, natural logarithm of x base e and exponential function ex vi. Absolute value of a given number x.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote