Okay, honestly...I have no idea what you just told me I needed to do. I'm super green to this stuff and am not really good with any terms or anything. I modified my code a little and it's at least showing me the hours in the table now, but not the charges. Can you "dumb it down" at all and explain what to do in the simplest terms possible?
Here's my new code -
insert
Code:
#include <stdio.h>
/*
Goal: Print out garage charges
Input: Hours Parked
Output: Car#, hours stayed, and charges
Requirements: An intenger
Formulas: charge = 2 + (0.5 * hoursStayed)
Test Plan:
Car Hours Charge
1 1.5 2.00
2 4.0 2.5
3 24.0 10.00
Total 29.5 14.50
*/
int main(void){
float charge;
float charge1;
float charge2;
float charge3;
float time1;
float time2;
float time3;
float charges;
float totalHours;
float totalCharges;
float hoursStayed;
printf("How many hours did each car stay?\n");
scanf("%f\n%f\n%f\n", &time1, &time2, &time3);
charge = calculateCharges();
totalHours = time1 + time2 + time3;
totalCharges = (charge1 + charge2 + charge3);
printf("\n");
printf("Car\tHours\t\tCharge\n");
printf("1\t%f\t%f\n", time1, charge1);
printf("2\t%f\t%f\n", time2, charge2);
printf("3\t%f\t%f\n", time3, charge3);
printf("TOTAL\t%f\t%f\n", &totalHours, &totalCharges);
system("PAUSE");
return 0;
}
calculateCharges(){
float charge1;
float charge2;
float charge3;
float hoursStayed;
if(hoursStayed < 3){
charge1 = 2.00;
}
if(hoursStayed > 3){
charge1 = (2 + (0.5 * (hoursStayed-3)));
}
if(hoursStayed < 3){
charge2 = 2.00;
}
if(hoursStayed > 3){
charge2 = (2 + (0.5 * (hoursStayed-3)));
}
if(hoursStayed < 3){
charge3 = 2.00;
}
if(hoursStayed > 3){
charge3 = (2 + (0.5 * (hoursStayed-3)));
}
return charge1, charge2, charge3;
}