Write a program in c++ to help paint shop shopkeeper to calculate the total amounts of purchase and goods inward. Admin mode - should be pwd protected ->in word option to add the records ->totals(ex:red = 10,green = 20,etc) ->modify records ->delete records sale mode - should not pwd protected note : customer should be able to select the color and quantity what ever he wants through purchase mode. Note : customer should be get the bill(display the total bill details with information) note : merchant should be able to select admine mode to inward the goods. Note : merchant can check the total sold items and pending quantity.
Answers
Answer:
Similiar to this question
Explanation:
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
class Customer
{
private:
int customer_id;
int membership_type;
float monthly_purchase;
float reward_points;
public:
Customer() {membership_type = 0; monthly_purchase = 0; reward_points = 0;}
int GetMonthlyPurchase() {return monthly_purchase;}
void EnterData(int numberOfCustomer)
{
customer_id = numberOfCustomer;
do
{
system("cls");
cout<<"Enter the membership type for "<<numberOfCustomer<<" customer : "<<endl;
cout<<"1. Standard"<<endl;
cout<<"2. Plus"<<endl;
cin>>membership_type;
} while (membership_type < 1 || membership_type > 2);
do
{
system("cls");
cout<<"Enter the monthly purchase for "<<numberOfCustomer<<" customer : ";
cin>>monthly_purchase;
} while (monthly_purchase < 0);
}
void CalculateRewardPoints(float totalMonthlyPurchase)
{
switch (membership_type)
{
case 1:
{
if (monthly_purchase < 75 ) reward_points = float(0.05 * totalMonthlyPurchase);
if (monthly_purchase >= 75 && monthly_purchase < 150) reward_points = float( 0.075 * totalMonthlyPurchase);
if (monthly_purchase >= 150 ) reward_points = float(0.1 * totalMonthlyPurchase);
} break;
case 2:
{
if (monthly_purchase < 150) reward_points = 0.06 * totalMonthlyPurchase;
if (monthly_purchase >= 150) reward_points = 0.13 * totalMonthlyPurchase;
} break;
}
}
void DisplayData()
{
cout<<"--------------------------------------------------------"<<endl;
cout<<"Customer number : "<<customer_id<<endl;
if (membership_type == 1) cout<<"Membership type : Standart"<<endl;
else
cout<<"Membership type : Plus"<<endl;
cout<<"Monthly purchase : "<<monthly_purchase<<endl;
cout<<"Rewards points : "<<reward_points<<endl;
cout<<"--------------------------------------------------------"<<endl;
}
};
int main()
{
int n;
cout<<"Enter the number of customer's : ";
cin>>n;
int total_monthly_purchase = 0;
Customer *mas = new Customer[n];
for (int i = 0; i < n; i++)
{
mas[i].EnterData(i+1);
total_monthly_purchase += mas[i].GetMonthlyPurchase();
}
system("cls");
for (int i = 0; i < n; i++)
{
mas[i].CalculateRewardPoints(total_monthly_purchase);
mas[i].DisplayData();
}
system("pause");
return 0;
}