Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming Write code to evaluate the physical state of multiple types of matter at a given temperature (and sea level pressure). You will need

Java Programming

Write code to evaluate the physical state of multiple types of matter at a given temperature (and sea level pressure). You will need to replace line 3 in this repl with your actual code.

Your program should

prompt the user with this string: "Enter a type of matter (water, hydrogen, mercury):"

read a String type of matter from System.in

prompt the user with this string: "Enter a decimal number as temperature (degrees C):"

read a decimal temperature from System.in

depending on the inputs, output a String describing the state of matter at that temperature using the following rules

For water:

Temp is 0 or below --> "solid"

Temp is between 0 and 100 (but not equal) --> "liquid"

Temp is 100 or above --> "gas"

For hydrogen:

Temp is 259.16C or below --> "solid"

Temp is between 259.16C and 252.879C (but not equal) --> "liquid"

Temp is 252.879C or above --> "gas"

For mercury:

Temp is 38.829C or below --> "solid"

Temp is between 38.829C and 356.619C (but not equal) --> "liquid"

Temp is 356.619C or above --> "gas"

For any other types of matter:

Output "I don't know about that material." with newline.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago