States of water

States of water

What is the current state of water?

In physics, a state of matter is one of the distinct forms in which matter can exist. Four states of matter are observable in everyday life: solid, liquid, gas, and plasma. Many intermediate states are known to exist, such as liquid crystal, and some states only exist under extreme conditions, such as Bose–Einstein condensates (in extreme cold), neutron-degenerate matter (in extreme density), and quark–gluon plasma (at extremely high energy).

Make


Write a program that outputs liquid state, solid state or gaseous state depending on the temperature of water in °C.

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram or selection statement to explain its purpose.

Complete the subprogram called `water_state` so that it:

  1. Returns solid if the temperature is less than or equal to zero.
  2. Returns liquid if the temperature is greater than zero but less than one hundred.
  3. Returns gaseous if the temperature is greater than one hundred.

Complete the `main program` so that:

  1. The user can input the temperature in degrees centigrade.
  2. It outputs the state of the water.

Typical inputs and outputs from the program would be:

Enter the temperature in °C: 20

The water is in a liquid state.


Enter the temperature in °C: -8

The water is in a solid state.


Enter the temperature in °C: 106.89

The water is in a gaseous state.

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Run the unit tests below to check that your program has met the success criteria.

Enter the temperature in °C: -12.5

The water is in a solid state.

Enter the temperature in °C: 7

The water is in a liquid state.

Enter the temperature in °C: 160.459

The water is in a gaseous state.

Check that you have:

  • Used comments within the code to describe the purpose of subprograms and conditions.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.

Registered in England and Wales: 10442992

VAT Number: 290 9845 58

Telephone: 01452 947500

Email: admin@craigndave.co.uk

Craig'n'Dave logo

Craig 'n' Dave

Bett Awards 2024 Finalist