Write an algorithm that Creates an attractive user interface that allows users to select sizes (S, M, L, XL) and quantity. Choose the most appropriate controls. Remember, the fewer keystrokes required of the user the better. Display the selections made by the user with the Process menu option. Include an option to exit the application. Include two more sizes, XSmall and XXLarge. Add statements that process the order by calculating the total cost. Each shirt is $16 except the XSmall and XXLarge; their speciality prices are $20 each Display the total cost of then selection. Include a help option that displays instructions. You can enhance your solution by allowing users to purchase different sizes on the same order.
Declare struct TShirt
Declare variable size as string
Declare variable price as double
Declare variable quantity as int
Declare variable totalCost as double
End struct
Start
Declare List cart
if menuProcess is click then
Creat TShirt object tShirt
Declare variable quantity as int
Read quantity from the textbox
if size='S' or size='M' or size='L' or size='XL' then
tShirt.price = 16
else
tShirt.price = 20
end if
tShirt.quantity = quantity
tShirt.totalCost = quantity * tShirt.price
addt Shirt to the cart
Display message: "Size: " + cmboSize.SelectedItem +
"Quantity: " + quantity +
"Thank you!"
end if
if menuInstruct is click then
Display message: "Selecting the 'Process' menu option will complete and place your order." +
"Selecting the 'Add to Cart' menu option will add your current selections to any previous selections made." +
"Selecting 'Reset' will reset your entire order." +
"To order more than 25 t-shirts of each size, please see the club president for a special order form."
end if
if menuProcess is click then
Declare variable report as string
Declare variable total as double =0
for i = 0 to cart size
report =report+ "Size: " + cart[i].size +
"Quantity: " + cart[i].quantity+
"Price: " + cart[i].price+
"Subtotal: " + cart[i].totalCost
total = total+ cart[i].totalCost
end for
report += "Total: " + total;
Display report
end if
Stop
Comments
Leave a comment