function calculateItemCost, displayTotalCost, readSaleRecord

What is below is the first part of what i have to do. So far i have pasted my code, i know it won't work or compile just want to know is it even right also what other steps should i be taking towards finishing this part?

There are 3 types of discount prices: basic (B), double (D) and triple (T), reducing the normal prices by 10%, 20% and 30% respectively.

Write a function calculateItemCost prototyped by
double calculateItemCost(double itemPrice, char discountType, unsigned quantity);
so that the execution of this function will return the price for quantity number of the item priced originally at itemPrice each, and currently discounted according to discountType. For instance,calculateItemCost(10.90, 'D', 2) will return 17.44 because 17.44=10.9*0.8*2. LikewisecalculateItemCost(5.50, 'B', 4) will return the value 19.8=5.50*0.9*4.

Write a driver program to illustrate the use of this function calculateItemCost unless the illustration will be done in your complete program jewelrySale.cpp.

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
#include <iostream>
using namespace std;

double calculateItemCost(double itemPrice, char discountType, unsigned quantity);

double calculateItemCost(double itemPrice, char discountType, unsigned quantity)
{
       struct Jewellery
       {
              int ID;
              double itemPrice;
              char DiscountType;
              int Quantity;
              char FinalPrice;
       };
switch (DiscountType)
{
       case 'A':
            A = itemPrice * 10 / 100;
            break;
       case 'B':
            B = itemPrice * 20 / 100;
            break;
       case 'C':
            C = itemPrice * 30 / 100;
            break;

}

int main ()
{

    
    Jewellery 101023;
    J1.itemPrice = 149.95;
    J1.DiscountType =;
    
    Jewellery 101024;
    J2.itemPrice = 199.95;
    
    Jewellery 100001;
    J3.itemPrice = 19.99;
    
    Jewellery 100002;
    J4.itemPrice = 39.99;
    
    Jewellery 103067;
    J5.itemPrice = 1999.00;


}
Topic archived. No new replies allowed.