Write a function called getCustomerInfo that reads from the keyboard the account
ID: 3807005 • Letter: W
Question
Write a function called getCustomerInfo that reads from the keyboard the account number, the date of sale (month, day, and year as 3 integers), the county code ('S' for San Diego County, 'o' for Orange County and 'L' for LA county). Write a function called getItemsInfo that reads the prices and the weights (integer of the items the customer is ordering. You don't know how many items the customer is buying. In this function, you need to sum up the prices (total sale amount) and the weights (total weight). The total sale amount and total weight will be used to calculate a discount, the sales tax, and the shipping cost. Sample run for the getItemsInfo function Do you want to order an item? Enter Y or N: Y Enter a price: 5.55 Enter a weight: 3 Do you want to order another item? Enter Y or N: Y Enter a price: 10.20 Enter a weight: 5 Do you want to order another item? Enter Y or N: N Hints t "In Do you want to order an item? Enter Y or N: cin choice while (choice 'Y) coutExplanation / Answer
#include "stdafx.h"
#include <iostream>
using namespace std;
int acc;
char countycode;
Date dos;
int totalweight;
double totalsaleammount;
double discount;
double salestax;
double shipping;
double totaldue;
struct Date
{
Date(int d, int m,int y)
{
day = d;
month = m;
year = y;
}
int day;
int month;
int year;
};
void getCustomerInfo()
{
int day;
int month;
int year;
cout << " enter the account number ";
cin >> acc;
cout << "enter day ";
cin >> day;
cout << "enter month ";
cin >> month;
cout << "enter year ";
cin >> year;
dos = new Date(day, month, year);
cout << "enter county code ";
cin >> countycode;
}
void getItemsInfo()
{
double price;
int weigth;
char choice;
cout << "Do you want to order a item ?? Enter Y or N ";
cin >> choice;
while (choice == 'Y')
{
cout << "enter a price:";
cin >> price;
cout << "enter weight";
cin >> weigth;
totalsaleammount = totalsaleammount + price;
totalweight = totalweight + weigth;
cout << "Do you want to order another item ?? Enter Y or N ";
cin >> choice;
}
}
void calcDiscount()
{
discount = 0.075*totalsaleammount;
}
void calcSalesTax()
{
salestax = 0.05*totalsaleammount;
}
void calcShipping()
{
shipping = totalweight / 5.3;
}
int main()
{
getCustomerInfo();
getItemsInfo();
calcDiscount();
calcSalesTax();
calcShipping();
totaldue = totalsaleammount + salestax + shipping-discount;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.