Need a help... please

im tried to settle this problem but have 1 error..

the Q

the ABC Company is small loundry that usus a special system to calculate the price for customer. the system calculation are as follow:

type price
1. Shirt $15 per kg
2. Blanket $ 6 per kg
3. Comforter $10 per kg

at one time only one type from the above type is allowed. the loundry also given some discount to it customer base on the foolowing price.

price total discount
>=$30 10% of price total
>=$20 5% of price total
>=$15 3%
<=$14 0%

calculate the price that has to be paid by customer. the output must produce are as follow


ABC COMPANY

no. of customer :
Price Total :
Discount :
price to be paid:

Next Customer (Y/N)...


my coding... but still have 1 error

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
138
139
140
141
142
143
144
145
146
147
#include <iostream.h>
#include <stdlib.h> // for system("pause") and system("cls")
#include <math.h> // for sqrt()
#include <conio.h>

void GetData(float & First, float & Second);
float Shirt(float First, float Second);
float Blanket(float First, float Second);
float Comforter(float First, float Second);


int main()


    {
    float First, Second, Answer, Discount, PaidTotal;
	int Choice;
	
    bool Quit = false;
    while(!Quit)


        	{
        	cout << "*******Menu*******" << endl;
        	cout << "1) Shirt" << endl;
        	cout << "2) Blanket" << endl;
        	cout << "3) Comforter" << endl;
        	cout << "4) Quit" << endl;
			cout << "******************" << endl;
        	cin >> Choice;
        	
PaidTotal=Answer-Discount;
			
		
			
			switch(Choice)


            	{
            	case 1:

            		{
           			GetData(First, Second);
          			Answer = Shirt(First, Second);
           			cout << " $ " << Answer << endl;
           			cout<<PaidTotal;
					break;
               		}
              	case 2:

                		{
             			GetData(First, Second);
                    			Answer = Blanket(First, Second);
                    			cout <<" $ " << Answer << endl;
                    			break;
                    		}
                    	case 3:


                        		{
                        			GetData(First, Second);
                        			Answer = Comforter(First, Second);
                        			cout << " $ " << Answer << endl;
                        			break;
                        		}
                        
                                                        	default:


                                                            		{
                                                            			return 0;
                                                            			break;
                                                            		}
                                                            	}
                                                            	system("pause");
                                                            	system("cls");
                                                            	}
                                                            return 0;

}

															
																		{

																     	if (Answer >=30)
																		{
																		Discount=0.10*Answer;
																		}
																		else if (Answer >=20)
																		{
																		Discount=0.05*Answer;
																		}
																		else if (Answer >=15)
																		{
																		Discount=0.03*Answer;
																		}
																		else if (Answer >=1)
																		{
																		Discount=0*Answer;
																		}
																		else
																		cout<<"0";
															
																
                                                        



                                                        void GetData(float & First, float & Second)


                                                            {
                                                            	cout << "Enter the weight: ";
                                                            	cin >> First;
                                                            	cout << "Price per Kg: $ ";
                                                            	cin >> Second;
																cout << "Total Price: ";
																cout << "Discount: "<<Discount;
																cout << "Price to be paid:<<PaidTotal ";

																
			
                                                        }

                                                        float Shirt(float First, float Second)


                                                            {
                                                            	return First * Second;
                                                        }

                                                        float Blanket(float First, float Second)


                                                            {
                                                            	return First * Second;
                                                        }

                                                        float Comforter(float First, float Second)


                                                            {
                                                            	return First * Second;
                                                        }
															}

Last edited on
look carefully, there is a floating if else block not inside any function block. after main ends and getdata() starts. You need to place that snippet in appopiate place. It is just some code alignment problem, landed up in mistake.
Topic archived. No new replies allowed.