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
|
#include<iostream>
#include<sstream>
#include<cmath>
using namespace std;
const string VERSION = "JEWELLERY";
const int MAXSIZE = 1000; // maximum number of records allowed
// function prototypes
void runMenu();
void displayMenu();
void clrscr();
void pause();
int numericalMenu(string);
double calculateItemCost ( double [], char [], unsigned []);
void displayTotalCost ( double [], unsigned [] );
int readSaleRecord ( unsigned [], double [], char [], unsigned []);
int main()
{
double option;
double allItems[MAXSIZE];
int discountRate;
return 0;
}
void runMenu( )
{
int option=0;
string word, msg = "Sale Record: ( 101024, 199.95, D, 1)"; // displaying the message
do
{
switch(option)
{
case 1: // calculate the item cost
double itemCost;
cout << "\nProcessing task " << option << "...\n";
msg = '0' + option;
msg += " was last selected\n";
system("pause");
break;
case 2: // Display the total cost
cout << "\nProcesssing task " << option << "...\n";
msg = '0' + option;
msg += " was last selected\n";
system("pause");
break;
case 3: // list sale records
cout << "\nProcessing task " << option << "...\n";
msg = '0' + option;
msg += " was last selected\n";
system("pause");
break;
}
}
while(option!=0);
}
void clrscr() //clear screen
{
system("cls");
}
void pause() //stops
{
system("echo.");
system("echo.");
system("pause");
}
void exit() //exit
{
exit(0);
}
void displayMenu(string msg) //displays menu
{
clrscr();
cout << msg << "\n *** JEWELLERY ***\n";
cout << "\n-------------------- MAIN MENU --------------------\n";
cout << "\n1. Calculate Item cost";
cout << "\n2. Display the total cost";
cout << "\n3. List the sale records";
cout << "\n4. Calculate the standard deviation";
cout << "\n---------------------------------------------------\n";
cout << "\nYour Choice => ";
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
//calculate the item cost
double calculateItemCost( double itemPrice, char discountType, unsigned quantity, double itemCost)
{
cout << "Enter itemPrice: ";
cin >> itemPrice;
cout << "Enter discountType: ";
cin >> discountType;
cout << "Enter quantity: ";
cin >> quantity;
itemCost = itemPrice * discountType * quantity;
cout << "The itemCost is " << itemCost;
return 0;
}
// display the total cost
void displayTotalCost ( double totalCost, unsigned recordNum, bool aborted)
{
if ( recordNum >0)
cout << "\ndisplayTotalCost: \n";
else ( recordNum <0);
cout << "Input terminated by invalid data at record";
return;
}
// display the sales record
int readSaleRecord ( unsigned & itemId, double & itemPrice, char & discountType, unsigned & quantity)
{
cout << "Enter itemId: ";
cin >> itemId;
cout << "Enter itemPrice: ";
cin >> itemPrice;
cout << " Enter discountType:";
cin >> discountType;
cout << " Enter quantity: ";
cin >> quantity;
system("PAUSE");
return true;
}
|