1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
// Stationery Ordering System.cpp : How much sales Writers Depot get for selling stationery.
//
/*
ICT1101 ASSIGNMENT 2 - GROUP
C++ code
*/
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
// output variables
float SaleBP, SaleNB, SaleFD, SalePL; // Sale amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
float PaidBP, PaidNB, PaidFD, PaidPL; // Paid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
float UnpaidBP, UnpaidNB, UnpaidFD, UnpaidPL; // Unpaid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
float TotalPaid; // Total paid amount.
float TotalUnpaid; // Total unpaid amount.
float NetProfit; // Net profit gained.
// When ordering
float TotalSales; // Total sales of all items ordered.
// process variables
float Discount; // Discount per order.
float npBluePen, npNotebook, npFolder, npPlanner; // Net profit of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
// input variables
char Option; // Choosing an option.
int Item = 1; // Chossing an item.
int BluePen; // Quantity of Blue pen 1.0 point.
int Notebook; // Quantity of One inch thick notebook.
int Folder; // Quantity of Two-pocket plastic folder.
int Planner; // Quantity of 200-pages blank planner.
// input
cout<< "Welcome to Writers Depot's Stationery Ordering System. Choose an option: \n" ;
cout<< "a. Enter order details \n" ;
cout<< "b. Display monthly report \n" ;
cout<< "c. Exit the system \n" ;
cout<< "Your option: " ;
cin>> Option ;
switch (Option)
{
case 'a': case 'A':
// Ordering menu
cout<< "------------------------MENU------------------------ \n" ;
cout<< " ITEM COST PER UNIT \n" ;
cout<< "1. Blue pen 1.0 point RM 0.20 \n" ;
cout<< "2. One inch thick notebook RM 2.50 \n" ;
cout<< "3. Two-pocket plastic folder RM 0.50 \n" ;
cout<< "4. 200-pages blank planner RM 2.50 \n" ;
cout<<endl;
cout<< "Choose '0' to calculate the total price of all the items. \n" ;
cout<< "Choose an item: " ;
cin>> ItemOption ;
switch (ItemOption)
{
case 1:
// Enter quantity of Blue pen 1.0 point
cout<< "You choose to buy Blue pen 1.0 point. \n" ;
cout<< "How many units you want to buy? \n" ;
cout<< "Quantity: " ;
cin>> BluePen ;
if (1 <= BluePen && BluePen <= 500)
{
Discount = 0.10;
}
else if (501 <= BluePen && BluePen <= 1000)
{
Discount = 0.20;
}
else if (1001 <= BluePen && BluePen <= 2000)
{
Discount = 0.35;
}
else
{
Discount = 0.50;
}
SaleBP = 0.20 * BluePen * Discount;
npBluePen = 0.50 * SaleBP;
cout<< "Current price: RM " << SaleBP <<endl;
break;
case 2:
// Enter quantity of One inch thick notebook
cout<< "You choose to buy One inch thick notebook. \n" ;
cout<< "How many units you want to buy? \n" ;
cout<< "Quantity: " ;
cin>> Notebook ;
if (1 <= Notebook && Notebook <= 500)
{
Discount = 0.10;
}
else if (501 <= Notebook && Notebook <= 1000)
{
Discount = 0.20;
}
else if (1001 <= Notebook && Notebook <= 2000)
{
Discount = 0.35;
}
else
{
Discount = 0.50;
}
SaleNB = 2.50 * Notebook * Discount;
npNotebook = 0.40 * SaleNB;
cout<< "Current price: RM " << SaleNB <<endl;
break;
case 3:
// Enter quantity of Two-pocket plastic folder
cout<< "You choose to buy Two-pocket plastic folder. \n" ;
cout<< "How many units you want to buy? \n" ;
cout<< "Quantity: " ;
cin>> Folder ;
if (1 <= Notebook && Notebook <= 500)
{
Discount = 0.10;
}
else if (501 <= Notebook && Notebook <= 1000)
{
Discount = 0.20;
}
else if (1001 <= Notebook && Notebook <= 2000)
{
Discount = 0.35;
}
else
{
Discount = 0.50;
}
SaleFD = 0.50 * Folder * Discount;
npFolder = 0.60 * SaleFD;
cout<< "Current price: RM " << SaleFD <<endl;
break;
case 4:
// Enter quantity of 200-pages blank planner
cout<< "You choose to buy 200-pages blank planner. \n" ;
cout<< "How many units you want to buy? \n" ;
cout<< "Quantity: " ;
cin>> Planner ;
if (1 <= Planner && Planner <= 500)
{
Discount = 0.10;
}
else if (501 <= Planner && Planner <= 1000)
{
Discount = 0.20;
}
else if (1001 <= Planner && Planner <= 2000)
{
Discount = 0.35;
}
else
{
Discount = 0.50;
}
SalePL = 2.50 * Planner * Discount;
npPlanner = 0.50 * SalePL;
cout<< "Current price: RM " << SalePL <<endl;
break;
case 0:
TotalSales = SaleBP + SaleNB + SaleFD + SalePL;
break;
default:
// Item not in our menu
cout<< "Sorry, no item option in the system. Please select again."<<endl;
}
break;
case 'b': case 'B':
// process
TotalPaid = PaidBP + PaidNB + PaidFD + PaidPL ; // Total paid amount.
TotalUnpaid = UnpaidBP + UnpaidNB + UnpaidFD + UnpaidPL ; // Total unpaid amount.
NetProfit = npBluePen + npNotebook + npFolder + npPlanner ; // Total net profit.
// output
cout<< "a. Total quantity ordered for each item:" <<endl;
cout<< " Blue pen 1.0 point : "<< BluePen <<endl;
cout<< " One inch thick notebook : "<< Notebook <<endl;
cout<< " Two-pocket plastic folder : "<< Folder <<endl;
cout<< " 200-pages blank planner : "<< Planner <<endl<<endl;
cout<< "b. Sale amount for each item:" <<endl;
cout<< " Blue pen 1.0 point : "<< SaleBP <<endl;
cout<< " One inch thick notebook : "<< SaleNB <<endl;
cout<< " Two-pocket plastic folder : "<< SaleFD <<endl;
cout<< " 200-pages blank planner : "<< SalePL <<endl<<endl;
cout<< "c. Paid amount for each item:" <<endl;
cout<< " Blue pen 1.0 point : "<< PaidBP <<endl;
cout<< " One inch thick notebook : "<< PaidNB <<endl;
cout<< " Two-pocket plastic folder : "<< PaidFD <<endl;
cout<< " 200-pages blank planner : "<< PaidPL <<endl<<endl;
cout<< "d. Unpaid amount for each item:" <<endl;
cout<< " Blue pen 1.0 point : "<< UnpaidBP <<endl;
cout<< " One inch thick notebook : "<< UnpaidNB <<endl;
cout<< " Two-pocket plastic folder : "<< UnpaidFD <<endl;
cout<< " 200-pages blank planner : "<< UnpaidPL <<endl<<endl;
cout<< "e. Total paid amount: "<< TotalPaid <<endl;
cout<< "f. Total unpaid amount: "<< TotalUnpaid <<endl;
cout<< "g. Net profit gained: "<< NetProfit <<endl;
break;
case 'c': case 'C':
break;
default:
;
}
return 0;
}
|