we have an assignment which states that we have to write a program that prints customers bills.
-the length and width of the room are expressed in meters and centimeters.
-The store does not sell fractions of a meter. Thus, the length and width must always be rounded up.
-The carpet charge is equal to the number of square meters purchased times the carpet cost per square meter. Sales tax equal to 14% of the carpet cost must be added to the bill.
-The labour cost is equal to the number of square meters purchased times R24.00, which is the labour cost per square meter. No tax is charged on labour.
-Each customer is identified by five-digit number, and that number should appear on the bill. Large-volume customers, identified by a customer number starting with '0', may be given a discount. The discount applies to the cost before sales tax is added.
-The sample output follows:
CROSSWELL CARPET STORE
STETEMENT
Customer name:XXXXX
Customer number: XXXXX
Carpet price:XX.XX
Labour : XX.XX
Subtotal : XX.XX
Less discount: XX.XX
Subtotal : XX.XX
Plus tax ; XX.XX
Total :XX.XX
-The function calculateCarpetSize takes as formal parameters the length and width of the room to be carpeted as floating point values and returns an integer representing the size of the room in square meters. Remember the store does not sell fractions of meters. Thus the length and width of the room must always be rounded up.
-The function calculateCarpetCost takes as formal parameters the size of the room as well as the selling price of the carpet and returns the cost of the carpet.
-The function calculateLabourCost takes the size of the room as formal parameter and calculates the labour cost. The labour cost is equal to a number of square meters purchased times R24.00. Note that tax is charged on labour.
-The boolean function qualifyForDiscount uses the customer number to determine if the customer qualifies for a discount. All customers identified by a customer number starting with a zero('0') qualify for discount.
-computeDiscount returns the discount amount for which the customers qualifes. It first prompts the user for the discount percentage and then calculates the discount.
-The final function printCustomerStatement takes as formal parameters the customer name, the customer number, the carpet and labour cost as well as the discount and prints the statement.(This function need not print out the statement on a printer.) It can just display it on the screen.
**The code i have written so far:
Please can someone check it as i am getting errors and i am not sure if the code i have written will produce what the question asks.
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
|
#include <iostream>
using namespace std;
void calculateCarpetSize (int length, int width)
{
float carpetSize = (length * width);
cout.setf(ios::fixed);
cout.precision(0);
}
void calculateCarpetPrice (float carpetSize, float sellingPrice )
{
float carpetPrice = ( carpetSize * sellingPrice );
}
void calculateCarpetCost (float carpetSize, float sellingPrice )
{
float salesTax = 0.14;
float carpetCost = (carpetSize * sellingPrice * salesTax);
cout.precision(2);
}
void calculateLabourCost ( float carpetSize, float labour)
{
labour = 24.00;
float labourCost = carpetSize * labour;
}
bool qualifyForDiscount (int customerNumber)
{
if ( int customerNumber < 99999)
{
void computeDiscount (float carpetCost);
return true;
}
else
{
return false;
}
}
void computeDiscount (float carpetCost, float discountPercentage)
{
cout << "Enter the percentage discount ." << endl;
cin >> discountPercentage;
carpetCostDiscount = carpetCost * discountPercentage
}
{
void printCustomerStatement( )
{
cout.setf(ios::fixed);
cout << endl;
cout << "CROSWELL CARPET STORE" << endl;
cout << "STATEMENT" << endl;
}
int main()
{
int customerName;
int customerSurname;
int customerNumber;
float carpetSize;
float sellingPrice;
float salesTax = 0.14
float labourCost;
int labour = 24.00;
float length;
float width;
float discount;
float discountPercentage;
cout.setf(ios::fixed);
cout.precision(2);
cout << "Please enter the information" << endl;
cout << "Enter the customer's first name: " << endl;
cin >> customerName;
cout << "\n Enter customers surname: " << endl;
cin >> customerSurname;
cout << "\n The length of the room: " << endl;
cin >> length;
cout << "\n Enter the width of the room: " << endl;
cin >> width;
cout << "\n Enter the carpet selling price: " << endl;
cin >> sellingPrice;
int printCustomerStatement()
{
cout << "\n Customer name : " << endl;
cin >> customerName >> customerSurname >> endl;
cout << "Customer number : " << endl;
cin >> customerNumber;
cout << "\n Carpet price : " << endl;
cin >> carpetPrice;
cout << "Labour : " << endl;
cin >> labour
cout << "\n Subtotal : " << endl;
cin >> carpetPrice;
cout << "Less Discount : " << endl;
cin >> qualifyForDiscount;
cout << "\n Subtotal: " endl;
cin >> carpetPrice;
cout << "Plus tax: " << endl;
cin >> salesTax;
cout << "Total: " << endl;
cin >> carpetPrice;
}
return 0;
}
}
|