ALGORITHM RECTANGLE
A company that makes building.
- Welcome user to Building making company
- Section A
- Ask the user for length of the building in meters between 10 and 1500
- Store the operation as Length
- if ((Length <10) or (Length >1500)):
- say "Invalid Input", the Length can only be between 10 and 1500
- Until the (Length == ≥ 10) and (Length == ≤ 1500)
- Loop Section A
- Section B
- Ask the user for Height of the building in meters between 4 and 1500
- Store the operation as Height
- if ((Height <40) or (Height >1500)):
- say "Invalid Input", the Height can only be between 4 and 1500
- Until (Height == ≥4) and (Height == ≤ 1500)
- Loop Section B
- Section C
- Ask for the width of the building in meters and it has to be above 10 and less than the Length
- Store the operation as Width
- if ((Width > Length) or (Width <= 10)):
- say "Invalid Input", Width can only be greater than 10 or less than the Length
- Until (Width == >10) and (Width == < Length)
- Loop Section C
- Section D
- Ask the user for cost per cubic meter between 1k and 75k
- Store the operation as Cost
- if ((Cost <1k) or (cost >75k)):
- say "Invalid Input", the cost can only be between 1k and 75k
- Until the (Cost == ≥ 1k) and (Cost == ≤ 75k)
- Loop Section D
-
- Calculate Length * Width * Height
- Store the operation as Volume
- Calculate Volume * Cost and store as price
- say 'Length is:' + length + 'meters'
- say 'Width is:' + width + 'meters'
- say 'Height is:' + height + 'meters'
- say 'Volume is:' + volume + 'cubic meters'
- say 'Cost per sq meter is: $' +Cost
- say 'Total price is: $' + total_price
- Ask user if they want to play again
- Store the operation as Choice
- else:
- say "Invalid Input", you can only chose either Yes or No
- if choice == 'Yes'
- loop to line 1
- if choice == 'NO'
- End Program