Write a program for an artist who is creating art instillation “experiences” consisting of rooms totally full of balloons that people will walk around in. Different instillations will be in different sized rooms and different sized balloons so need different numbers of balloons to fill them. The salesperson will enter the length, width and height of the room in centimetres. Write separate methods to input each of these values (they may possibly call other general methods) and return the results. These three numbers are multiplied together to get the volume of the room. This should by then be converted to m3 (calculated by dividing the volume by 1,000,000). This is then divided by the volume taken up by each balloon in m3 as given by the user. Print out the final number of balloons to be ordered along with the intermediate results as in the examples below. The final answer should be given as an integer (rounded down) as below.
a) Write a program for an artist who is creating art instillation “experiences” consisting of rooms totally full of balloons that people will walk around in. Different instillations will be in different sized rooms and different sized balloons so need different numbers of balloons to fill them. The salesperson will enter the length, width and height of the room in centimetres. Write separate methods to input each of these values (they may possibly call other general methods) and return the results. These three numbers are multiplied together to get the volume of the room. This should by then be converted to m3 (calculated by dividing the volume by 1,000,000). This is then divided by the volume taken up by each balloon in m3 as given by the user. Print out the final number of balloons to be ordered along with the intermediate results as in the examples below. The final answer should be given as an integer (rounded down) as below.
An example run of the program is as follows (numbers in bold are typed in by the user, either pop-up boxes or the console may be used for input and output):
Length of the room (in cm)? 4600
Width of the room (in cm)? 310
Height of the room (in cm)? 200
What is the balloon volume (in m3)? 0.03
Your room volume is 285.2 m3.
You need 9506 balloons.
Another example run:
Length of the room (in cm)? 1000
Width of the room (in cm)? 520
Height of the room (in cm)? 330
What is the balloon volume (in m3)? 0.07
Your room volume is 171.6 m3.
You need 2451 balloons.
- You can round down to an integer, getting rid of spurious decimal places, using the integer cast operator (int) - see the interactive notebook on types
Step by step
Solved in 2 steps with 1 images