The objective of this exercise is to give you practice using operators and type casting.
4. Test the program using the PersonTest class with the ages of 1, 24, and 100.
5. Write a class called Order that contains two variables of type int called int1
and int2 and a method called calculateTotal.
6. Write a calculateTotal method that multiplies the two integer values and prints
the result.
7. Test the program using the OrderTest class. Test the program with:
Note – Remember to cast the two integers so that the temporary container
is large enough to hold the result of multiplying two 5-digit or 9-digit int
types. See the caution message earlier in this module.
Task 3 – Creating a Temperature Program
In this task, you write a program called Temperature containing a temperature in
Fahrenheit and a method called calculateCelsius. Follow these steps to create a
Temperature class:
• Ensure that you get the same result with the program as you do when doing
the calculation manually (or using a calculator)
Person.java
.
public class Person {
} // end calculateAge
} // end class