This is my program but i cant get it to calculate my cost
These are my calculations:
1) if the color of the car is blue and the cost of the car is less than 1200 add 10% of the cost of the car to the cost of the car
2) If the color of the car is black and the cost of the car is greater than 100 but less than 1500 add 20% of the cost of the car to the cost of the car
3) If the color of the car is white and cost is less than or equal to 2000 then subtract 500 from the cost of the car
// Description: Display person name, address, calculated and
// actual cost of car and color of car
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
#include <iomanip.h>
int x;
char st_name[25];
char st_address[75];
char st_color[25];
float f_ccost;
float f_acost;
void getdata();
void processdata();
void putdata();
int main()
{
for(x=1;x<=3;x++)
{
getdata();
processdata();
putdata();
}
}
void getdata()
{
cout << "\n\nPlease enter your name: ";
cin.getline(st_name,25);
cout << "\n\nPlease enter your address: ";
cin.getline(st_address,75);
cout << "\n\nPlease enter the amount you paid for your car: ";
cin >> f_acost;
cin.get();
cout << "\n\nPlease enter your car color: ";
cin.getline(st_color,25);
}
void processdata()
{
cout << "\n\nCalculated amount of your car is: ";
if(f_acost < 1200)
{
if(strcmp(st_color,"blue")==0)
{
f_ccost = f_acost + 10.0/100;
cout << f_ccost;
}
else
{
cout << f_acost;
}
}
else if(f_acost > 1000.00 && f_acost < 1500.00)
{
if(strcmp(st_color,"black")==0)
{
f_ccost = f_acost + 2.0/100;
cout << f_ccost;
}
else
{
cout << f_acost;
}
}
else if(f_acost <= 2000.00)
{
if(strcmp(st_color,"white")==0)
{
f_ccost = f_acost - 500.00;
cout << f_ccost;
}
else
{
cout << f_acost;
}
}
else
{
cout << f_acost;
}
}
void putdata()
{
cout << "\n\nPerson Name: " << st_name;
cout << "\n\nAddress: " << st_address;
cout << setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(2);
cout << "\n\nActual Cost of Car: $ " << f_acost;
cout << "\n\nCalculated Cost of Car: $ " << f_ccost;
cout << "\n\nColor of Car: " << st_color;
}