Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Sure Heres an example of how you can implement the class with the getWaterState method in Java java ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

Find the sum of the finite geometric sequence. 1.

Answered: 1 week ago