Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Write a class named MathCalculations. Use proper javadoc to comment the class and its methods. In the class, you must write the following methods:
2. Write a class named MathCalculations. Use proper javadoc to comment the class and its methods. In the class, you must write the following methods: A method named find Min that accepts three integers as parameters and returns the smallest of the three values. For example, the call find Min(1,10,-1) would return-1. You must use the Math class min() method in your findMin() method (note that the Math class min() method only takes 2 parameters so you will need to call Math.min() twice). A method named findMax that accepts three doubles as parameters and returns the largest of the three values. For example, the call find Max(1,10,-1) would return 10.0. You must use the Math class max() method Write a main method in the class that: o calls find Min(5, 7, 3) and prints the returned result (see below for format). o calls findMax(-5.1, 32.5, 56.8) and prints the returned result (see below for format) o calls findMax(20, 25, 15) and prints the returned result (see below for format). You can call the methods with the actual numbers exactly as shown above, you do not need to assign the input numbers to variables. This means the style checker magic number errors can be ignored. When printing the result of the find Min() and find Max() method calls, you must print the returned values, do NOT use a literal (hard coded) value for the result in the print statements. You should use literal values in your print statements for the input numbers (5, 7, 3,-5.1, 32.5, 56.8, 20, 25, 15). For example: System.out.println(" The minimum of 5, 7, and 3 is " + minimum); where minimum is the value returned from the find Min(5, 7, 3) call. The output of your program must be formatted as follows: The minimum of 5, 7, and 3 is 3 The maximum of-5.1, 32.5, and 56.8 is 56.8 The maximum of 20, 25, and 15 is 25.0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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