Question

In: Computer Science

Writes a program that prints the insurance fee to pay for a Vehicle according to the following rules:

C++ Programm

Automobile Insurance Program:

Writes a program that prints the insurance fee to pay for a Vehicle according to the following rules:

  • A Honda that is All Wheel Drive costs $450.

  • A Honda that is two wheels drive costs $350.

  • A Toyota that is All Wheel Drive costs $300.

  • A Toyota that is Two Wheel Drive costs $250.

  • A Nissan that is All Wheel Drive costs $200.

  • A Nissan that is Two Wheel Drive costs $280

    Any other type of vehicle generates an error message. The program should prompt the user for the appropriate information, using a code to determine the kind of Vehicle (i.e. H or h represents a Honda, T or t represents a Toyota, N or n represents Nissan. And y or n for the AWD).

    After printing the insurance fee, the program should ask the user if (s) he wants to ensure another Vehicle using repetition structure.

    Solution Source Code C++:

Solutions

Expert Solution

C++ Code:

#include

#include

using namespace std;

int main() {

char ch,ch1,ch2;

int cost;

cout<<"Enter Vehicle type:\n(H/h) for Honda\n(T/t) represents Toyota\n(N/n) for Nissan:\n ";

cin>>ch;

switch(ch){

case 'H':

case 'h':

cout<<"Is it AWD :(Y/N)";

cin>>ch1;

if(ch1=='Y'||ch1=='y')

cost=450;

else

cost=350;

break;

case 'T':

case 't':

cout<<"Is it AWD :(Y/N)";

cin>>ch1;

if(ch1=='Y'||ch1=='y')

cost=300;

else

cost=250;

break;

case 'N':

case 'n':

cout<<"Is it AWD :(Y/N)";

cin>>ch1;

if(ch1=='Y'||ch1=='y')

cost=200;

else

cost=280;

break;

default:

cout<<"Wrong choice";

}

cout<<"The insurance cost is $"<

cout<<"Do you wish to check for another vehicle(Y/N): ";

cin>>ch2;

if(ch2=='Y'||ch2=='y')

main();

else

exit(0);

}


Related Solutions

Automobile Insurance Program: Writes a program that prints the insurance fee to pay for a Vehicle...
Automobile Insurance Program: Writes a program that prints the insurance fee to pay for a Vehicle according to the following rules: A Honda that is All Wheel Drive costs $450. A Honda that is two wheels drive costs $350. A Toyota that is All Wheel Drive costs $300. A Toyota that is Two Wheel Drive costs $250. A Nissan that is All Wheel Drive costs $200. A Nissan that is Two Wheel Drive costs $280.
Automobile Insurance Program: Writes a program that prints the insurance fee to pay for aVehicle...
Automobile Insurance Program:Writes a program that prints the insurance fee to pay for a Vehicle according to the following rules:A Honda that is All Wheel Drive costs $450.A Honda that is two wheels drive costs $350.A Toyota that is All Wheel Drive costs $300.A Toyota that is Two Wheel Drive costs $250.A Nissan that is All Wheel Drive costs $200.A Nissan that is Two Wheel Drive costs $280.
Write a program that prints the insurance fee to pay for a pet according to the...
Write a program that prints the insurance fee to pay for a pet according to the following rules:(NOTE:You must use a switch statement to determine pet fee.)A dog that has been neutered costs $50.A dog that has not been neutered costs $80.A cat that has been spayedcosts $40.A cat that has not been spayedcosts $60.A bird or reptile costs nothing.Any other animal generates an error message.The program should prompt the user for the appropriate information: a character code for the...
Write a C++ program that prints the insurance fee to pay for apet according to...
Write a C++ program that prints the insurance fee to pay for a pet according to the following rules:(NOTE:You must use a switch statement to determine pet fee.)A dog that has been neutered costs $50.A dog that has not been neutered costs $80.A cat that has been spayedcosts $40.A cat that has not been spayedcosts $60.A bird or reptile costs nothing.Any other animal generates an error message.The program should prompt the user for the appropriate information: a character code for...
Write a C++ program to calculate the price of the annual insurance of a private vehicle according to the following table.
Write a C++ program to calculate the price of the annual insurance of a private vehicle according to the following table. Age of the person Model year of the car History of Accident Insurance price Less than 40 years Less than 2015 Yes 20 % more than price of last year No 15 % more than price of last year Later than 2015 Yes 12 % more than price of last year No 10 % more than price of last...
java program Create a program that creates and prints a random phone number using the following...
java program Create a program that creates and prints a random phone number using the following format: XXX-XXX-XXXX. Make sure your output include the dashes.  Do not let the first three digits contain an 8 or 9 (HINT: do not be more restrictive than that) and make sure that the second set of three digits is not greater than 773. Helpful Hint:   Think though the easiest way to construct the phone number. Each digit does do not have to be determined...
Python Without running / testing the following code, predict what the following program prints on the...
Python Without running / testing the following code, predict what the following program prints on the screen. freeze = int(32) boil = int(212) freeze = 0 boil = 100 print(freeze, boil) Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1 = Monday, 2 = Tuesday and so forth. If the user types in a 6 then "Saturday" should be printed...
(C++) Write a program that prints a table in the following format given a "x" read...
(C++) Write a program that prints a table in the following format given a "x" read from the keyboard. For example, if x is 4, it prints out 0 0 1 1 2 4 3 9 4 16 To avoid mismatch, put 8 white spaces between two numbers.
Create a basic program (C Programming) that accomplishes the following requirements: Prints "for loop" and then...
Create a basic program (C Programming) that accomplishes the following requirements: Prints "for loop" and then uses a for statement to count from 1 to 100. Prints "while loop" and then uses a while statement to count from 1 to 100. Prints "do while loop" and then use a do while statement to count from 1 to 100. Using a nested if/else statement or a switch in one of the loops , print to the screen if a number is:...
According to the solubility rules given in Topic7b; predict whether or not the following salts would...
According to the solubility rules given in Topic7b; predict whether or not the following salts would dissolve in water (be sure to give the rule you used to make the prediction) A) Potassium Acetate B) Na2S C) copper(II) phosphate D) NH4Cl E) Silver (I) Iodide F) BaSO4 G) manganese (II) nitrate H) CuS I) Cr(OH)3 J) Ammonium phosphate
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT