Alex Perello
Algorithm
welcome to lazy grass
repeat
ask user to enter width between 30 and 150
get width
if ((width<30) or (width>150))
*invalid number*
until ((width>=30) and (width<=150))
repeat
ask user for length between 50 and 200
get length
if ((length<50) or (length>200))
*invalid number*
until ((length>=50) and (length<=200))
repeat
ask user what type of turf
1. artificial turf
2. sports turf
3. commercial turf
4. residential turf
get choice
if (Choice!= 1) && (Choice!= 2) && (Choice!= 3) && (Choice!= 4)
*invalid input
until (Choice== 1) or (Choice== 2) or (Choice== 3) or (Choice== 4)
//artificial turf cost
if choice == 1
grasmat = 7
labor = 13
//sports turf cost
if choice == 2
grassmat 6
labor 10
//commercial turf
if choice == 3
grassmat 8
labor 12
//residential turf
if choice == 4
grassmat 9
labor 14
//show user the cost once chosen
display on screen: "The cost of grass and materials: $ ", grassmat, " / m^2 and the labor and installation is $" labor, "/m^2"
//calculate total cost
Area = length * width
MaterialCost = Area * grassmat
laborCost = Area * labor
CostBeforeTax = MaterialCost + LaborCost
GST = 0.05 x CostBeforeTax
PST = 0.07 x MaterialCost
TotalCost = CostBeforeTax + GST + PST
Display Bill
//ask user if they want
repeat
1. yes
2. no
get choice
if (Choice!= 1) && (Choice!= 2)
*invalid input*
until (Choice== 1) or (Choice== 2)
if choice == 1
go back to beginning
else
*Goodbye and thank you for choosing lazy grass*
repeat
ask user to enter width between 30 and 150
get width
if ((width<30) or (width>150))
*invalid number*
until ((width>=30) and (width<=150))
repeat
ask user for length between 50 and 200
get length
if ((length<50) or (length>200))
*invalid number*
until ((length>=50) and (length<=200))
repeat
ask user what type of turf
1. artificial turf
2. sports turf
3. commercial turf
4. residential turf
get choice
if (Choice!= 1) && (Choice!= 2) && (Choice!= 3) && (Choice!= 4)
*invalid input
until (Choice== 1) or (Choice== 2) or (Choice== 3) or (Choice== 4)
//artificial turf cost
if choice == 1
grasmat = 7
labor = 13
//sports turf cost
if choice == 2
grassmat 6
labor 10
//commercial turf
if choice == 3
grassmat 8
labor 12
//residential turf
if choice == 4
grassmat 9
labor 14
//show user the cost once chosen
display on screen: "The cost of grass and materials: $ ", grassmat, " / m^2 and the labor and installation is $" labor, "/m^2"
//calculate total cost
Area = length * width
MaterialCost = Area * grassmat
laborCost = Area * labor
CostBeforeTax = MaterialCost + LaborCost
GST = 0.05 x CostBeforeTax
PST = 0.07 x MaterialCost
TotalCost = CostBeforeTax + GST + PST
Display Bill
//ask user if they want
repeat
1. yes
2. no
get choice
if (Choice!= 1) && (Choice!= 2)
*invalid input*
until (Choice== 1) or (Choice== 2)
if choice == 1
go back to beginning
else
*Goodbye and thank you for choosing lazy grass*