Professional Documents
Culture Documents
CUPCAKE - Task 2 Ahmad Solehuddin Bin Nizar (2019252848)
CUPCAKE - Task 2 Ahmad Solehuddin Bin Nizar (2019252848)
CUPCAKE - Task 2 Ahmad Solehuddin Bin Nizar (2019252848)
COURSE : CSC425
GROUP# : EC2203A1
PROGRAM DESCRIPTION : A PROGRAM WHICH CAN CALCULATE THE TOTAL PRICE (BEFORE AND
Sid#: 2019252848
Course: CSC425
Group#: EC2203A1
Program Description: A program which can calculate the total price (before and after discount) and delivery charge based on the destination.
*/
#include <iostream>
// Variables
// Welcome Message
cout << "We sell cupcakes and provide delivery service for our dearest customer around Klang Valley, Negeri Sembilan and Melaka!" << endl;
cout << "Its your lucky day! You can enjoy our variation of promotion if u buy more than 20 pieces of cupcakes :)" << endl;
// Price of Cake
cout << "Here is our list of cupcake and its price per piece: " << endl;
// Promotion:
cout << "Promotion (%) discount based on number of cake u ordered: " << endl;
cout << "1. Less than 20 pieces : No discount " << endl;
cout << "4. More than 50 pieces : 30% discount " << endl;
cout <<
"______________________________________________________________________________________________________________________________
" << endl;
// Input statement
cout << "Please enter your selected cupcake using number below : " << endl;
cout << "Enter the amount of cupcakes that you want: " << endl;
cout << "Enter your destination for delivery using number below: " << endl;
// Output statement
if (cake_code==1){
cout << "Your selected cupcake is: Chocolate Moist" << endl;
cout << "Your selected amount does not reach for any discount." << endl;
cout << "Hence, your total price now is: RM" << total_price << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 10% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
}
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 20% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Ooops, I think that you have entered an invalid value at the selection amount of cupcakes XD ";
else if (cake_code==2){
cout << "Your selected cupcake is: Red Velvet" << endl;
cout << "Your selected amount does not reach for any discount." << endl;
cout << "Hence, your total price now is: RM" << total_price << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 10% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 20% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
}
else if (destination_code<=0 or destination_code>3){
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 30% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Ooops, I think that you have entered an invalid value at the selection amount of cupcakes XD ";
else if (cake_code==3){
cout << "Your selected amount does not reach for any discount." << endl;
cout << "Hence, your total price now is: RM" << total_price << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 10% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 20% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
}
else if(destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
cout << "Your selected amount of cupcake qualified you for a 30% discount." << endl;
cout << "Your total price before discount is: RM" << total_price << endl;
cout << "Total price after discount is: RM" << after_discount << endl;
if (destination_code==1){
delivery_charge = 10.00;
cout << "Your selected delivery area is: Klang Valley (RM10)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==2){
delivery_charge = 20.00;
cout << "Your selected delivery area is: Negeri Sembilan (RM20)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total << endl;
else if (destination_code==3){
delivery_charge = 35.00;
cout << "Your selected delivery area is: Melaka (RM35)" << endl;
cout << "The total price you have to pay (including delivery) is: RM" << total_total;
cout << "Ooops, I think that you have entered an invalid value at the selection of destination XD" << endl;
cout << "Hence, I cannot reveal the total amount you have to pay :)";
}
cout << "Ooops, I think that you have entered an invalid value at the selection amount of cupcakes XD ";
cout << "Ooops, I think that you have entered an invalid value in the selection of cupcakes XD ";
return 0;
}
Sample Input and Output