Question: Program #1 Program Description : Many cities levy traffic fines based on a flat rate and a per dollar charge for each mile over the

Program #1

Program Description: Many cities levy traffic fines based on a flat rate and a per dollar charge for each mile over the speed limit the vehicle was travelling. Write a program that determines the fine based on the following:

A charge of $20.00 for the ticket.

An additional charge of $5.00 for each mile over the speed limit that the vehicle was traveling.

For example: Suppose a driver was ticketed for driving 42 mph in a 30 mile per hour zone. He was going 12 miles over the limit (42-30 = 12). The ticket would be:

$20 + $5.00 X (42-30) = $80

Use variables for:

Speed limit (Both will be whole numbers entered from the keyboard.)

User speed

Sample Screen Output:

Enter the speed limit: 30

Enter the vehicle speed: 42

The fine will be: $80

Sample Screen Output:

Enter the speed limit: 55

Enter the vehicle speed: 70

The fine will be: $95

Use method for your input. Make sure that your screen output looks similar to the sample output above.

Program #2

Program Description: Write a program that inputs the radius of a circle from the user. The program will attractively output the area and circumference of the circle, as well as the volume and surface area of a sphere with the supplied radius.

Use p (PI) =3.14159;

Area = pr2

Circumference = 2pr

Volume = (4/3) pr3

Surface Area = 4pr2

Sample Screen Output:

Enter the radius of a circle: 13.45

A circle with radius 13.45 has:

Area of 568.321484975

Circumference of 84.508771

Volume of 10191.8986305

Surface Area of 2273.2859399

Use method for you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!