Question
The following table lists the freezing and boiling points of several substances. Substance Freezing Point Alcohol -173.2 Oxygen -361.8 Water 32.0 Design a class in
The following table lists the freezing and boiling points of several substances.
Substance | Freezing Point |
Alcohol | -173.2 |
Oxygen | -361.8 |
Water | 32.0 |
Design a class in JAVA that stores a temperature in a temperature field and has the appropriate accessor and mutator methods for the field. In addition to appropriate constructors, the class should have the following methods:
isAlcoholFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of ethyl alcohol. Otherwise, the method should return false.
isOxygenFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of oxygen. Otherwise, the method should return false.
isWaterFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of water. Otherwise, the method should return false.
Write a program that demonstrate the class. The program should ask the user to enter a temperature, and then display a list of the substance that will freeze at that temperature. For example, if the temperature is -200.8, the class should report that water will freeze and alcohol will freeze at that temperature.
You need to design a class Temperature, and then demo it in the second file TemperatureDemo.java
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