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...
(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.
use Python datetime module, strftime Write a program that processes the following textfile and prints the...
use Python datetime module, strftime Write a program that processes the following textfile and prints the report shown below. Textfile: Ask the user for the filename and BE SURE TO CHECK THAT IT EXISTS. The file will contain lines which each contain 2 strings (bookTitle and publicationDate) separated by a comma and a space. Note that the title of the book might contain spaces! Example of the textfile: Gone Girl, 5-24-2012 To Kill A Mockingbird, 7-11-1960 Harry Potter and the...
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
1. I need a java program that prints the following rows of arrays, like shown [3,5,6...
1. I need a java program that prints the following rows of arrays, like shown [3,5,6 7, 61, 71, 9, 99, 999, 4, 1, 0] 2. I also need a program that prints the sum of all the arrays 3. and a third program that only prints the elements from row one. Thanks!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT