Question: Compose a class and, in this class, create two static methods: A method called getWaterState, which takes a single integer parameter called temperature and returns



Compose a class and, in this class, create two static methods:

A method called getWaterState, which takes a single integer parameter called temperature and returns a String.

The method should return a single word identifying the state of water at different temperatures in 0F. Use the following rules:

- Under 320F, the water is ice.

- Above 320F but under 2120F, the water is liquid.

- Above 2120F, the water is vapor.

- At exactly 320F or 2120F, the water is freezing or boiling, respectively.

A main method to demonstrate your getWaterState method; use it to print the statements below at the given temperatures.

Sample output:

For temperatures 0, 32, 80, 212, 240:

The state of water at 0 degrees Fahrenheit is ice. The state of water at 32 degrees Fahrenheit is freezing. The state of water at 80 degrees Fahrenheit is liquid. The state of water at 212 degrees Fahrenheit is boiling. The state of water at 240 degrees Fahrenheit is vapor.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Sure Heres an example of how you can implement the class with the getWaterState method in Java java ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!