Algorithm Rectangle
Partner Project - Ihsaan, Vibhor
A company that makes buildings
- GST = 5%
- PST = 7%
- Ask if they want to calculate price or size and store as operation, Assume answer 1 or 2
- If operation != (1) or operation != (2):
- say 'Invalid input, you can only calculate size or cost'
- loop back to line 3
- Ask for length of the Building in meters between 10 and 1000 and store as length
- If length < (10) or length > (1000):
- say 'Invalid Input, length can only be greater than 10 and less than 1000'
- loop back to line 7
- Ask for width of the building in meters and it has to be above 10 and less than the length and store as width
- If width > (length) or width < (10):
- say 'Invalid Input, width can only be greater than 10 or less than length'
- loop back to line 11
- Ask for height of the building in meters between 4 and 1000 and store as height
- If height < (4) or height > (1000):
- say 'Invalid Input, height can only be greater than 4 or less than 1000'
- loop back to line 15
- Volume = length * width * height
- say 'Length is:' + length + 'meters'
- say 'Width is:' + width + 'meters'
- say 'Height is:' + height + 'meters'
- say 'Volume is:' + volume + 'cubic meters'
- if operation == (2),
- Go to line 44
- If operation == (1):
- Ask for cost per cubic meter between 1 and 50000 and store as rate
- If rate < (0) or rate > (50000):
- say 'Invalid Input, rate can only be between 1 and 50000'
- loop back to line 26
- Ask for labor fee between 1 and 500000 and store as labor
- If labor < (0) or labor > (5000):
- say 'invalid input, labor fee can only be between 0 and 500000'
- loop back to line 31
- price = Volume * Rate and store as price
- GST_price = GST * price and store
- PST_price = PST * price and store
- total_price = Calculate price + GST price + PST price + labor
- say 'Cost per meter^3 is: $' + rate
- say 'labor fee is: $' + labor
- say 'GST is: $' + GST price
- say 'PST is: $' + PST price
- say 'Total price is: $' + total_price
- Ask if the user wants to play again and store it as choice, assume answer yes or no
- if choice != (yes) and choice != (no)
- say 'invalid input, you can only choose either yes or no'
- loop back to line 44
- If choice == (yes)
- loop back to line 1
- If choice == (no)
- end program