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...
Suppose you are writing a program to compute the semester GPA for a person based on...
Suppose you are writing a program to compute the semester GPA for a person based on knowing the grades earned and the number of credit hours for each course taken. What type of tests would you need to create to check that your program was working correctly? Be specific, and remember to keep in mind tests that might contain unexpected input. How would your program react to those? After you have made your post, you need to provide thoughtful comments...
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...
Make a C++ program that reads the age of a person, if the person is between...
Make a C++ program that reads the age of a person, if the person is between 12 and 17 years old, a message that says "Teenager!" otherwise print "Not a teenager."
Submit a menu based C++ program that can compute at least Ten Mathematical functions from <math.h>...
Submit a menu based C++ program that can compute at least Ten Mathematical functions from <math.h> or <cmath.h> library.   The input is provided by the user.
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...
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...
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.*********
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT