ipsian 0 Report post Posted February 6, 2008 im tried to settle this problem but have 1 error..the Qthe ABC Company is small loundry that usus a special system to calculate the price for customer. the system calculation are as follow:type price1. Shirt $15 per kg2. Blanket $ 6 per kg3. Comforter $10 per kgat 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 followABC COMPANYno. of customer :Price Total :Discount :price to be paid:Next Customer (Y/N)...my coding... but still have 1 error#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: RM "; 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; } } Quote Share this post Link to post Share on other sites
mfar 0 Report post Posted February 10, 2008 (edited) kindly re-arrange your coding... to many open and closing brackets!! But i'm sure that you make mistake because there are too many "opening" rather than "closing"!! Edited February 10, 2008 by mfar Quote Share this post Link to post Share on other sites
TOYSЯUS 62 Report post Posted February 10, 2008 Logical error kot?I don't see any unclosed bracket(s)?But yes, need to re-arrange maybe.And I found this, but still doesn't solve the error:cout << "Discount: "<<Discount; cout << "Price to be paid:<<PaidTotal ";//misplace closing " sign---PaidTotal unreferred variable warning// Quote Share this post Link to post Share on other sites
ipsian 0 Report post Posted February 13, 2008 Logical error kot?I don't see any unclosed bracket(s)?But yes, need to re-arrange maybe.And I found this, but still doesn't solve the error:cout << "Discount: "<<Discount; cout << "Price to be paid:<<PaidTotal ";//misplace closing " sign---PaidTotal unreferred variable warning//alhamdulillah.. semuanya dah setel.... terpaksa ubah sikit sebanyak... tak pakai function tapi guna nested if else dan switch saje..anyway kepada yg sudi membantu.. thanks a lot Quote Share this post Link to post Share on other sites