Create a Class diagram and pseudo code
for program that allows bags to be purchased. There are six different types: full decorative, beaded, needlepoint design, fringed beaded and plain. Create a ListBox object for the different styles. After the user makes a selection, display a message indicating which selection was made. Include an option to clear selections. Include a control that allows the user to enter the quantity desired. Include a set of radio buttons that contain shipping options of overnight, three day and standard. The price for each bag is as follows: full decorative R50; beaded – R45; needlepoint design – R40, fringed beaded – R30 and plain – R20. The shipping charges are based on the total purchase. The following percentages are used: Overnight – 10%, three day – 7% and standard – 5%. Display in a message box the shipping charge along with the selection, quantity and total cost.
pseudo code
Start
Declare array bagPrices = { 50,45,40,30,20}
Declare constant STANDARD = 0.05
Declare constant THREE_DAY = 0.07
Declare constant OVERNIGHT = 0.10
Declare variable quantity
Declare variable subTotalCost
Declare variable selectedStyle
Declare variable shippingCharge
Declare variable result
Declare variable totalCost
Get selectedStyle from listbox
Read quantity from the textbox
Set subTotalCost = bagPrices[selectedStyle] * quantity
Set shippingCharge = subTotalCost * STANDARD
if ThreeDay Radiobutton is Selected then
shippingCharge = subTotalCost * THREE_DAY
End if
if Overnight Radiobutton is Selected then
shippingCharge = subTotalCost * OVERNIGHT
End if
Set totalCost = subTotalCost + shippingCharge
Set result= "Subtotal cost: " + subTotalCost +
"Quantity: " + quantity+
"Shipping charge: " + shippingCharge+
"Total cost: " + totalCost
Display result
Stop
Class diagram
Comments
Leave a comment