Question

In: Computer Science

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.

Solutions

Expert Solution

-->I am solving this problem in C language.

->explanation of the code written in as comments in the programme.

C programme code:

#include<stdio.h>
int main() //main
{
   int choose,choose2; //declaring variables
   printf("1.Honda \t 2.Toyoto \t 3.Nissan\n"); //vehicle menu
   printf("Choose(1,2 or 3) Vehicle from above:"); //asking input from user
   scanf("%d",&choose); //taking input from user
   if(choose==1) //condition 1
   {
       printf("\n\n1.All Wheel \t 2.Two Wheel\n"); //vehicle wheel type menu
       printf("Enter your Honda Wheel type:"); //asking input from user
       scanf("%d",&choose2); //taking input from user
       if(choose2==1) //condition 1
       {
           printf("\nInsurance fee to pay your Honda vehicle is= $450"); //display the insurance
       }
       else if(choose2==2) //condition 2
       {
           printf("\nInsurance fee to pay your Honda vehicle is= $350"); //display the insurance
       }
       else //false condition
       {
           printf("\nPlease choose respective vehicle wheel type only i.e 1 or 2"); //error message
       }
      
   }
   else if(choose==2) //condition 2
   {
       printf("\n\n1.All Wheel \t 2.Two Wheel\n");
       printf("Enter your Toyota Wheel type:");
       scanf("%d",&choose2);
       if(choose2==1)
       {
           printf("\nInsurance fee to pay your Toyota vehicle is= $300");
       }
       else if(choose2==2)
       {
           printf("\nInsurance fee to pay your Toyota vehicle is= $250");
       }
       else
       {
           printf("\nPlease choose respective vehicle wheel type only i.e 1 or 2");
       }
   }
   else if(choose==3) //condition 3
   {
       printf("\n\n1.All Wheel \t 2.Two Wheel\n");
       printf("Enter your Nissan Wheel type:");
       scanf("%d",&choose2);
       if(choose2==1)
       {
           printf("\nInsurance fee to pay your Nissan vehicle is= $200");
       }
       else if(choose2==2)
       {
           printf("\nInsurance fee to pay your Nissan vehicle is= $280");
       }
       else
       {
           printf("\nPlease choose respective vehicle type only i.e 1 or 2");
       }
   }
   else //false condition
   {
       printf("\nPlease choose respective vehicle type only i.e 1 or 2 or 3");
   }
  
   return 0;
}

Image reference/Output:


Related Solutions

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.
Writes a program that prints the insurance fee to pay for a Vehicle according to the following rules:
C++ ProgrammAutomobile 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 $280Any other type of vehicle generates an error message. The program should...
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...
If you buy an automobile, the law requires you to have insurance for that vehicle. Explain...
If you buy an automobile, the law requires you to have insurance for that vehicle. Explain the difference between liability auto insurance and full coverage auto insurance. Which insurance would you select for a new car? Why?
Write a program to determine the cost of an automobile insurance premium, based on the driver's...
Write a program to determine the cost of an automobile insurance premium, based on the driver's age and the number of accidents that the driver has had. The basic insurance charge is $500.There is a surcharge of $100. if the driver is under 25 and an additional surcharge for accidents: No. of accidents ► Accident Surcharge 1 ► 25 2 ► 25 3 ► 75 4 ► 75 5 ► 100 6 or + ► No assurance
A motor vehicle has annual depreciation of $2,000, oil changes cost $280, automobile insurance cost $420,...
A motor vehicle has annual depreciation of $2,000, oil changes cost $280, automobile insurance cost $420, and license plates cost $140 . What is the annual amount of the total fixed operating cost for this vehicle?
Automobile insurance companies require drivers they insure have a valid drivers’ license and will not pay...
Automobile insurance companies require drivers they insure have a valid drivers’ license and will not pay 100% of damage claims. Explain why.
is staff training an expense or asset? is delivery fee an expense or asset? is vehicle...
is staff training an expense or asset? is delivery fee an expense or asset? is vehicle hire an expense or asset?
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT