Uploaded by hashir.fatmi2

computer science coding

advertisement
Assessment: Java Basics
Do one of the following. You must demonstrate all best practices in the design of your code for
full credit. The name of your class must be JavaBasics.
Do this to get 100%:
Write a program that calculates the amount of concrete
needed for a new building.
The city of Toronto has decided to build a new opera
house in the shape of a pentagonal prism. They are
debating how many floors to give the new building, and
how wide to make the building.
The amount of concrete needed can be calculated using
the below formula:
Where:



A represents the amount of concrete needed, in meters2
a represents the length of a base edge, in meters
h represents the height of the building, in meters
Each floor of the new building will be exactly 5 meters tall. So, if the building has two floors,
then h is 10.
The program must ask the user to enter two values: the length of a base edge (a), and the
maximum possible numbers of floors.
The program must then print out the total amount of concrete needed for every possible
number of floors from 1 up to the maximum entered by the user.
Example output is below.
Do this to get 75%:
Write a program that calculates the volume of a pentagonal prism.
Below is the formula for volume of a pentagonal prism:
Where:



V represents the volume
a represents the length of a base edge
h represents the height of the prism
The program must ask the user to enter values for a and h, as
decimals.
It must calculate and output the volume, rounded to the nearest
integer.
Example output is below.
Example 1
Example 2
Download