Write a program to calculate the cost of car insurance based on the driver age and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to calculate the cost of car insurance based on the driver age and number of accidents. a) prompt the user to enter his/her age; at the end, print the cost of insurance for the user. b) the base insurance cost is $300 c) if the driver age is below 27, there is a surcharge of $100 d) the additional surcharge for accidents is shown below: Number of accidents 1 2 3 4 or more Surcharge $100 $150 $250 $1000 a. Create a new program called Time.java. b. Create variables named hour, minute, and second. Assign values to these variables that represent the time 30 seconds after 5:15pm. Use a 24-hour clock. For example, for 2pm, the value of hour is 14. Make the program calculate and display the number of seconds since midnight. c. Calculate and display the number of seconds remaining in the day. d. Bonus: Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. The speed of sound is approximately 340 meter per second. Because the speed of light is much faster than the speed of sound, during a thunderstorm first you see a lightning flash then you hear the sound of thunder a few seconds later. a) Start a program named SpeedLight.java (class name, main method) b) calculate the distance to a lightning strike based on the time elapsed between the flash and the sound of thunder. (you have to rearrange the formula "speed = distance / time" to obtain the distance as a function of the speed of sound (above) and a variable "time") c) test your program for the variable time 5 seconds. Note: you don't need a Scanner; just hard-code the value of time = 5. Write a program to calculate the cost of car insurance based on the driver age and number of accidents. a) prompt the user to enter his/her age; at the end, print the cost of insurance for the user. b) the base insurance cost is $300 c) if the driver age is below 27, there is a surcharge of $100 d) the additional surcharge for accidents is shown below: Number of accidents 1 2 3 4 or more Surcharge $100 $150 $250 $1000 a. Create a new program called Time.java. b. Create variables named hour, minute, and second. Assign values to these variables that represent the time 30 seconds after 5:15pm. Use a 24-hour clock. For example, for 2pm, the value of hour is 14. Make the program calculate and display the number of seconds since midnight. c. Calculate and display the number of seconds remaining in the day. d. Bonus: Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. The speed of sound is approximately 340 meter per second. Because the speed of light is much faster than the speed of sound, during a thunderstorm first you see a lightning flash then you hear the sound of thunder a few seconds later. a) Start a program named SpeedLight.java (class name, main method) b) calculate the distance to a lightning strike based on the time elapsed between the flash and the sound of thunder. (you have to rearrange the formula "speed = distance / time" to obtain the distance as a function of the speed of sound (above) and a variable "time") c) test your program for the variable time 5 seconds. Note: you don't need a Scanner; just hard-code the value of time = 5.
Expert Answer:
Answer rating: 100% (QA)
1 Here is a program called Timejava that calculates the cost of car insurance based on the drivers a... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
(a) Consider a sequence of random variables X1, X2, X3, X4, X5, X6, X7, . . . which are all independent and uniformly distributed on the interval [0,1]. i. Calculate the probability density functions...
-
1. Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Solve the triangles with the given parts. a = 7.86, b = 2.45, C = 2.5
-
Suppose that we have a multiprogrammed computer in which each job has identical characteristics. In one computation period, T, for a job, half the time is spent in I/O and the other half in processor...
-
With reference to Table 4.2, suggest one method by which you might separate (a) K1 from Ag1, (b) Ba21 from Pb2+, (c) NH+4 from Ca2+, (d) Ba2+ from Cu2+.
-
True or False: Welding on a fan blade requires the welding grounding clamp to be placed on the fan impeller itself.
-
Selected balance sheet accounts for Tibbetts Company on September 30, 2010, are as follows: Cash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ 32,000 Marketable...
-
On January 2, Year 1, a motorcycle dealer sells a motorcycle with an extended warranty for two years beyond the manufacturer's two-year warranty and an agreement to service the vehicle for the first...
-
What is the value of CP's revised offer on December 8 (before CP "sweetened" its offer by adding the CVR security)? In your analysis, assume the following: a) A valuation date of December 31, 2015,...
-
Write down the expressions for reflection and transmission coefficients for both TE and TM cases when the incidence angle is 0. Calculate the values for and air-glass interface when nair 1.00 and...
-
What role does role-taking, empathy, and perspective-taking play in fostering social understanding and cooperation among individuals occupying different roles within a social system ?
-
Read"Why Race Isn't as"Black"and White"as We Think"by Brent Staples. What can you find out about your own racial,religious,and cultural heritage? Search the Gateway library database: Ancestry Library...
-
Identify the effective income tax rate disclosed by Nike in each of its last three fiscal years and compare that to the IRS corporate income tax rates for those years. Identify at least two items...
-
A point charge +210C is fixed at the origin. If you move a second point charge +5x10-6C from the position with x=0.45m, y=0.36m to a new position with x=0.79m, y=0.94m. What is work done by the...
-
Your portfolio which consists of 46% of stock J, and 54% of stock K. J has daily Standard Deviation 3% while K has daily Standard Deviation 4%. The correlation of two stocks is -0.6. What is the 1...
-
The expected returns and standard deviation of returns for two securities are as follows: Security Z Security Y Expected Return 15% 35% Standard Deviation 20% 40% The correlation between the returns...
-
Which, if any, of the dichloroethene molecules drawn in Data Table II (3.) (4.) and (5.) are geometric isomers? A. B. C. D. cis-1,2-dichloroethene and trans-1,2-dichloroethene...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
Sherry Hopson owns a retail family clothing store. Her store is located at 4321 Circle Drive, Houston, TX 77001. Her employer identification number is 95- 1234321 and her Social Security number is...
-
Ulysses and Penelope are married and file separate returns for 2012. Penelope itemizes her deductions on her return. Ulysses' adjusted gross income was $17,400, his itemized deductions were $2,250,...
-
What would be the most effective option to increase employee motivation to stay and reduce the driver turnover rate? Why do you believe this option will be effective?
-
How else might the manager have handled the situation to prevent potential issues, including a negative impact on the teams performance?
-
In what ways do you believe providing special work arrangements or accommodations for employees impacts employee motivation? How does it help? How does it hurt?
Study smarter with the SolutionInn App