Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in java code Create each of the following classes in the com.javaoo.calculators package: a. BasicCalculator b. ScientificCalculator C. Trigonometric Calculator Individually Licensed to Trey Williams
in java code Create each of the following classes in the com.javaoo.calculators package: a. BasicCalculator b. ScientificCalculator C. Trigonometric Calculator Individually Licensed to Trey Williams kercise 2: Adding Attributes and Methods For each of the calculator classes, add the necessary attributes and methods as specified below. BasicCalculator: a. Declare the following public methods i. add() ii. subtract() iii. multiply () iv. divide () b. Each method must accept two parameters, both of type double c. Each method must return a double. Add code to the return statement that calculates and returns the correct value. Example: public final double multiply (double x, double y) { return x * y; Scientific Calculator: d. Must declare the following attributes: i. A double named PI to hold the value of PI (3.14159). This attribute will be shared by all instances of the class and will be constant so it should be declared as static and final. Since it is a final, it can have public visibility so that anyone can use it. ii. A double named holdvalue to hold a value in memory. Since it will be managed within the ScientificCalculator class, it should have private visibility. ii. e. Declare the following public methods i. exp() which has one parameter of type double and returns a double This method will be used to calculate ex] log() which has one parameter of type double and returns a double [This method will be used to calculate in x] iii. putValueInMemory () which has one parameter of type double and returns a void. Implement this method. iv. getValue FromMemory () which has no parameters and returns a double Implement this method TrigonometricCalculator: g. Declare the following public methods i. sine () ii. cosine () iii. tangent () iv. arcsine () v. arccosine () vi. arctangent () h. Each metod must accept one parameter of type double . Each method must return a double j. We will not provide the details of each method in this lab. For your code to compile, add the following single statement to each method block: return(0)
in java code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started