Question

In: Computer Science

Help with a c Program to compute the car insurance premium for a person based on...


Help with a c Program to compute the car insurance premium for a person based on their age and the number of tickets they have received. The following table explains how to perform the ticket computation:
If Person's Age Is

Then Insurance Cost Is

Less than 21

$1500 + $250 x number of tickets

From 21 through 24

$1200 + $250 x number of tickets

25 or older

$1000 + $200 x number of tickets

Print the person’s age, number of tickets and the computed insurance cost.

Solutions

Expert Solution

NOTE: I have completed program for your assignment. Please check and let me know if you have any questions. I will acknowledge back with a response within 24 hours. Thanks for your patience.

Code:

#include <stdio.h>

int main()

{

/* declaring variables */

int age, no_of_tickets;

double cost;

/* reading person age and tickets received */

printf("\nEnter the age of person: ");

scanf("%d", &age);

printf("\nEnter the number of tickets received: ");

scanf("%d", &no_of_tickets);

/* calculating insurance cost based on age and number of tickets */

if(age < 21)

cost = 1500 + (250 * no_of_tickets);

else if(age >= 21 && age <= 24)

cost = 1200 + (250 * no_of_tickets);

else if(age >= 25)

cost = 1000 + (200 * no_of_tickets);

printf("\nPersons age: %d", age);

printf("\nNumber of tickets: %d", no_of_tickets);

printf("\nInsurance Cost: %f", cost);

printf("\n");

return 0;

}

Code output screenshot:


Related Solutions

C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage = (new_odometer – old_odometer)/(gallons_gas) // illustrating how ‘for’ loop works. 2. How to initialize an array of size 5 using an initializer list and to compute it’s sum How to initialize an array of size 5 with even numbers starting from 2 using ‘for’ loop and to compute it’s sum 3. Program to compute the car insurance premium for a person based on their...
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
Help with c program that will have a system pause at the end. 1. Program to...
Help with c program that will have a system pause at the end. 1. Program to compute the car insurance premium for a person based on their age and the number of tickets they have received. The following table explains how to perform the ticket computation: If Person's Age Is: Then Insurance Cost Is- Less than 21 $1500 + $250 x number of tickets From 21 through 24 $1200 + $250 x number of tickets 25 or older $1000 +...
To determine the insurance premium of a car, an insurancecompany considers the following determinants: the...
To determine the insurance premium of a car, an insurance company considers the following determinants: the model of the car , the age of the car, and the mileage of the car. Which of the following is the dependent variable? Please explain why you chose this answer to better understand why you chose it. I believe it is A due to using the cars mileage and always determines the premium of the bill. But then i believe it is C.insurance...
Program in C++ **********Write a program to compute the number of collisions required in a long...
Program in C++ **********Write a program to compute the number of collisions required in a long random sequence of insertions using linear probing, quadratic probing and double hashing. For simplicity, only integers will be hashed and the hash function h(x) = x % D where D is the size of the table (fixed size of 1001). The simulation should continue until the quadratic hashing fails.*********
Write a C++ program to help the Administration of a football league to manipulate the list...
Write a C++ program to help the Administration of a football league to manipulate the list of players registered in different teams. There are 26 teams participating in the league, each is denoted by a letter in the range A to Z. Each team can have 11 players at most. The information of all teams' players are stored in a text file named 'players.dat'. Each line from the input file contains the details of one player; where the player's details...
A researcher for a car insurance company wishes to estimate themean annual premium that men...
A researcher for a car insurance company wishes to estimate the mean annual premium that men aged 20-24 years pay for their car insurance. A random sample of 50 men aged 20-24 years shows a mean of $711. Assume that the distribution of annual premiums has a standard deviation of $185.a) Find a 94% confidence interval for the mean annual premium for all men aged 20-24 years.b) What is the error of the estimate?c) Find the 99% confidence interval for...
the employment insurance premium reduction program grants employers a reduced: 1) Employee Premium Rate 2) Employer...
the employment insurance premium reduction program grants employers a reduced: 1) Employee Premium Rate 2) Employer and employee premium rate 3) employer group insurance premium rate 4)employer premium rate
To write a C++ program for following scenario and display requirements: Scenario-based Problem: AIG Insurance wants...
To write a C++ program for following scenario and display requirements: Scenario-based Problem: AIG Insurance wants to create an insurance management system for their clients. The insurance management system will compute the required payments from the clients. The commission of the agent shall also be computed which depends on the amount of insurance type. Insurance Type Amount of Insurance type Agent Commission Life 2500 12.5% of amount Health 1500 10.5% of amount Other inputs 0 0 Computation of monthly payments...
in C++ Write a program to compute the current and the power dissipation in an AC...
in C++ Write a program to compute the current and the power dissipation in an AC circuit that has four resistors R1, R2, R3, and R4 in parallel. The voltage source is V. Test your solution with various voltage levels and resistor values. Execute and submit the program and the results in screen captures. Please note that the equivalent resistor is given by 1/Rtotal = 1/R1 + 1/R2 + 1/R3 + 1/R4 and the current I is given by I...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT