Question

Speeding Fine Calculator You have been hired by the police department of the city you live...

Speeding Fine Calculator

You have been hired by the police department of the city you live in to create a program to calculate the fine that a motorist could pay. If the motorist was travelling at or below the speed limit, there is no fine. If the motorist is travelling over the speed limit, the amount of the fine is determined based on the table below. The speed limit that will be entered is a multiple of 5 from 5 to 85.

For example, if the speed limit was 30 and the speed measured was 34, the motorist was travelling 13.33% [ (34 - 30) / 30 ] over the speed limit. From the table, a motorist travelling 13.33% over the speed limit of 30 is liable for a fine of $180.

Percentage over Speed Limit
Speed Limit Less than 5% 5% - Less than 10% 10% - Less than 25% 25% or more
25 or lower 70 85 120 180
26 - 45 85 120 180 250
46 - 65 100 150 200 300
Over 65 150 200 300 500

The program will prompt for the speed limit and the actual speed the motorist was measured travelling. When the information is entered, the program will determine whether a fine is due or not and if a fine is due, what the fine amount is. The posted speed limit will always be a whole number.

Write pseudocode for the program and then code the pseudocode using the Python programming

  • Pseudocode file (e.g. speedingfinecalculator.txt)
  • Python program (e.g. speedingfinecalculator.py
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

void main()

{

int speed,i,limit=30,per;

printf("Enter speed : ");

scanf("%d",&speed);

if(speed<limit)

{

printf("No Fine");

}

else

{

per=(speed-limit)/limit;

}

if(speed<25)

{

if(per<5)

printf("Fine = 70");

else if(per>5 && per<10)

printf("Fine = 85");

else if(per>10 && per<25)

printf("Fine = 120");

else if(per>25)

printf("Fine = 180");

}

else if(speed>25 && speed<45)

{

  if(per<5)

printf("Fine = 85");

else if(per>5 && per<10)

printf("Fine = 120");

else if(per>10 && per<25)

printf("Fine = 180");

else if(per>25)

printf("Fine = 250");

}

else if(speed>45 && speed<65)

{

if(per<5)

printf("Fine = 100");

else if(per>5 && per<10)

printf("Fine = 150");

else if(per>10 && per<25)

printf("Fine = 200");

else if(per>25)

printf("Fine = 300");

}

else if(speed>65)

{

if(per<5)

printf("Fine = 150");

else if(per>5 && per<10)

printf("Fine = 200");

else if(per>10 && per<25)

printf("Fine = 300");

else if(per>25)

printf("Fine = 500");

}

}

Add a comment
Know the answer?
Add Answer to:
Speeding Fine Calculator You have been hired by the police department of the city you live...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Create an algorithm for a program that simulates a police radar gun. The algorithm should...

    1. Create an algorithm for a program that simulates a police radar gun. The algorithm should read an automobile speed (in km/h) and print the message “Speeding” if the speed exceeds 60kmh. The algorithm should then also calculate the appropriate fine. If the speed is 5 km/hr or less over this limit, only issue a warning. $80 for more than 5 and no more than 10 kmh above the limit, $150 for more than 10 but no more than 20kmh...

  • IN C++ FORMAT it will have a txt file with January 0 -10 -20 -12 February...

    IN C++ FORMAT it will have a txt file with January 0 -10 -20 -12 February 0 20 -30 -10 March 5 45 20 32 April 25 65 45 55 May 12 75 32 66 June 18 85 65 72 July 6 98 88 90 August 18 102 82 91 September 16 85 65 73 October 12 72 45 59 November 5 62 30 45 December 0 46 -15 33 Write a program using structures to store the following weather...

  • just the extra credit part please Your customer needs an automated system to patrol the highways....

    just the extra credit part please Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least...

  • Congratulations! You have just been hired by Refiners-R-Us. As part of your initial training, you have...

    Congratulations! You have just been hired by Refiners-R-Us. As part of your initial training, you have been asked to analyze two crude oils that they are considering for refining operations. Calculate the profit per barrel for each crude oil, Crude X and Crude Y. The costs of each crude oil and the refining costs are shown below. State which crude oil is the most profitable to refine and also state what the refining margin is in $ per barrel. INPUTS...

  • Can somone show me how to do the 1st problem? Need to find the LS and...

    Can somone show me how to do the 1st problem? Need to find the LS and SS for the fit and the LH and SH for the hole. Fits are all SHAFT BASIS METRIC but the shaft and hole diameters can not be used right out of the table. This is because the 3mm shaft tolerance does not match. You will need to lookup the "Fit" from the table, and then use the LS (Largest Shaft) and SS (Smallest Shaft)...

  • You did not receive full credit for this que Suppose you have the information shown in...

    You did not receive full credit for this que Suppose you have the information shown in the table below about the quantity of a good supplied and demanded at various prices Price (S) Quantity demanded Quantity supplied 180 50 40 30 20 140 100 60 20 40 20 10 60 80 a. Draw the demand and supply curves from the data provided. Instructions: Use the tools provided (D1 and S1) to plot the demand curve (5 points total) and the...

  • i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

    i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

  • Assignment Brief You have been appointed as a business analyst at Carlson Department Store. Your first project is to provide an analysis for an insurance claim for the company’s loss of sales for quar...

    Assignment Brief You have been appointed as a business analyst at Carlson Department Store. Your first project is to provide an analysis for an insurance claim for the company’s loss of sales for quarter 4 of last year due to a hurricane last summer. In your analysis, you are to make appropriate recommendations in relation to sales the company would have had. A. Background The Carlson Department Store suffered heavy damage after a hurricane struck late last summer. The store...

  • H J к Income Statement Debit Credit 200 B с D E F G 4 5...

    H J к Income Statement Debit Credit 200 B с D E F G 4 5 Instructions: The worksheet and the financial statements have been started and outlined. Where you see the word 6 "FORMULA", that is where a formula should be typed in Cash and AR in rows 13 and 14 have been 7 done for you as an example. Sometimes the formula is just bringing a number over to the next area in that case 8 type =...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT