Answer to Question #266680 in Algorithms for Israel

Question #266680

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.

 



1
Expert's answer
2021-11-20T14:20:43-0500


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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS