| EJonah (7) | |||||
Right now this is the program I created:
I'm supposed to find price for carpet considering their length, width, and cost per square foot with labor cost and tax. I'm having problems at the end "void printdata" function where the installation and total isn't declared first. What should i put instead to fix it or is there anyway to solve the problem? I want to calculate (length*width*costpersqfoot) + (length*width*LABOR_COST) for installation. Then installation*TAX_RATE for the total cost. But its only giving me 0 or just 1 for the answer earlier. Also at my "for loop", I'm not sure if I used it correctly since im only a beginner. I wanted to read count for the loop and use for loop based on the count. So for example: If i input 3 for the count then i would input length, width, costpersqfoot 3x
or if i want to input the numbers 4 times, then it would be:
If anyone can help me, then that would be very much appreciated. Thank you! | |||||
|
|
|||||
| meeram (22) | |
|
1. Change the printdata method with the signature of void printdata (float installation, float total). Change the declaration, definition and calling places. 2. Move the couple of lines for getting the num outside of loop and put it after the declaration of num. int num; cout<< "Enter a number for the count: " <<endl; cin>> num; const int MAXCOUNT = num; //read count for the loop int count; 3. Add the installation amount for calculating the total cost inclusive of tax. total = installation + totalprice (installation); //find total cost | |
|
|
|