A user is prompted to enter a positive number representing a vehicle’s speed. Use the variable speed to store entered data.

computer science

Description

Write a working C program to calculate fines for speeding. The program will do the following:

       A user is prompted to enter a positive number representing a vehicle’s speed. Use the variable speed to store entered data.

       The program will then determine the fine based on the following:

o   Fine is: $0                                                        → if between 0 - 80km/h

o   Fine is: $30 + $2.50 * (speed - 80)                 → if speed is between 81 - 100km/h

o   Fine is: $100 + $5 * (speed - 100)                  → if speed is above 100km/h

 

 

       If speeding fine is equal to zero (0) the following message is displayed on the screen:

o   Nothing to pay!

       If speeding fine is greater than zero (0), display a message with the speeding fine on the screen.

 

If you cannot do everything, do as much as possible. Part marks will be assigned for incomplete programs (see marking scheme below). Keep saving your program. Do your own work!

When you have finished, save your program as lab_test1.c. Submit your program electronically on Blackboard and hand in this paper with your name and student number on it, along with your reference sheet. Do not take your program with you. Do not save it on a USB stick, email it to yourself, or save it to a cloud service.

 

Correct program structure

1

 

Correct use of printf

2

 

Correct use of variables

1

 

Correct use of operators

2

 

Correct use of scanf

2

 

Correct use of if-else statement

2

 

 

 

 

Total:

10

 

 

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.