PENGATURCARAAN BERSTRUKTUR (MTS 3013) ASSIGNMENT 1 MUTIARA INDAH COMPANY DISCOUNT SYSTEMMUHAMAD BASYIR BIN MAT NAWI (D20122061847) SEMESTER 1 (SESI 2012/2013) PENSYARAH PROFESOR MADYA DR. NOR HASBIAH BINTI UBAIDULLAH FAKULTI SENI, KOMPUTERAN DAN INDUSTRI KREATIF (FSKIK)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Based on the information given by the company, the discount system should applyaccordingly to the Table 1.0 below when the sale officer input/enter the unit of purchased
item and price. So the input of the system is unit item and price.
35 discount = 0.05 ; //Set discount to 0.05 if price above RM100.00 when unitrange is 0 to 9
36 } 37 } 38 else 39 { 40 cout << "\tInvalid price" << endl ; //Warn a user when input price is less than zero41 } 42 43 } 44 else if ( unit <= 99 ) 45 { 46 if ( price >= 0 ) 47 { 48 if ( price <= 10.00 ) 49 { 50 discount = 0.05 ; //Set discount to 0.05 if price RM0.00 to RM10.00 when
unit range is 10 to 9951 } 52 else if ( price <= 100.00 ) 53 { 54 discount = 0.07 ; //Set discount to 0.07 if price RM10.01 to RM100.00 when
unit range is 10 to 9955 } 56 else 57 { 58 discount = 0.09 ; //Set discount to 0.09 if price above RM100.00 when unit
range is 10 to 9959 } 60 } 61 else 62 { 63 cout << "\tInvalid price" << endl ; //Warn a user when input price is less than zero64 } 65 } 66 else if ( unit <= 499 ) 67 { 68 if ( price >= 0 ) 69 { 70 if ( price <= 10.00 ) 71 {
72 discount = 0.09 ; //Set discount to 0.09 if price RM0.00 to RM10.00 whenunit range is 100 to 499
73 } 74 else if ( price <= 100.00 ) 75 { 76 discount = 0.15 ; //Set discount to 0.15 if price RM10.01 to RM100.00 when
unit range is 100 to 49977 } 78 else 79 { 80 discount = 0.21 ; //Set discount to 0.21 if price above RM100.00 when unit
range is 100 to 49981 } 82 } 83 else 84 { 85 cout << "\tInvalid price" << endl ; //Warn a user when input price is less than zero86 } 87 } 88 else if ( unit <= 999 ) 89 { 90 if ( price >= 0 ) 91 { 92 if ( price <= 10.00 ) 93 { 94 discount = 0.14 ; //Set discount to 0.14 if price RM0.00 to RM10.00 when
unit range is 500 to 99995 }
96 else if ( price <= 100.00 ) 97 { 98 discount = 0.23 ; //Set discount to 0.23 if price RM10.01 to RM100.00 when
unit range is 500 to 99999 } 100 else 101 { 102 discount = 0.32 ; //Set discount to 0.32 if price above RM100.00
when unit range is 500 to 999103 } 104 } 105 else 106 {
107 cout << "\tInvalid price" << endl ; //Warn a user when input price is lessthan zero
108 } 109 } 110 else 111 { 112 if ( price >= 0 ) 113 { 114 if ( price <= 10.00 ) 115 { 116 discount = 0.21 ; //Set discount to 0.21 if price RM0.00 to RM10.00
when unit range is above 999117 } 118 else if ( price <= 100.00 ) 119 { 120 discount = 0.32 ; //Set discount to 0.32 if price RM10.01 to
RM100.00 when unit range is above 999121 } 122 else 123 { 124 discount = 0.43 ; //Set discount to 0.43 if price above RM100.00
when unit range is above 999125 } 126 } 127 else 128 { 129 cout << "\tInvalid price" << endl ; //Warn a user when input price is less
than zero130 } 131 } 132 } 133 else 134 { 135 cout << "\tUnit or Price can't be equal or less than zero" << endl ; //Warn a user when
input price less than zero or unit is negative136 } 137 138 tprice = price * unit ; //Calculate total full cost139 discount_given = tprice * discount ; //Calculate total discount given140 pay = tprice - discount_given ; //Calculate total after discount141