Sunday, October 11, 2009

Final Insurance Rate Program

Finished the insurance fee program. I think it's accurate. It's not copy & pasting right but this shows where I fixed the errors I was confused about.


/* This program prints the annual insurance fee for a person based on their car value, age, and number of tickets they have received*/

#include

#include


using namespace std;


int main ()


{

int carValue, age, numberOfTickets;

cout << "Enter your car value: \n";

cin >> carValue;

cout << "Enter your age: \n";

cin >> age;

cout << "How many tickets have you received? \n";

cin >> numberOfTickets;

float baseRate;

baseRate = (carValue*.05);

float ageRate;

if (age<=24)

ageRate=(carValue*.0575);

else if ((age>=25) && (age<=29))

ageRate=(carValue*.055);

else

ageRate=baseRate;

switch (numberOfTickets)

{

case 0: cout << "Your annual insurance rate is " <<>"\n";

break;

case 1: cout << "Your annual insurance rate is " <<>1.10 << "\n";

break;

case 2: cout << "Your annual insurance rate is " <<>1.25 << "\n";

break;

case 3: cout << "Your annual insurance rate is " <<>1.50 << "\n";

break;

default: cout << "Hop on a bike and start peddling. You are so denied.";

}

return 0;

}




/* program output */




Running

Enter your car value:

10000

Enter your age:

35

How many tickets have you received?

1

Your annual insurance rate is 550


Running

Enter your car value:

15000

Enter your age:

29

How many tickets have you received?

2

Your annual insurance rate is 1031.25


Running

Enter your car value:

850

Enter your age:

19

How many tickets have you received?

3

Your annual insurance rate is 73.3125


Running

12500

Enter your age:

81

How many tickets have you received?

4

Hop on a bike and start peddling. You are so denied.

No comments:

Post a Comment