1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mars2501 [29]
3 years ago
14

Write a program which will enter information relating to a speeding violation and then compute the amount of the speeding ticket

. The program will need to enter the posted speed limit, actual speed the car was going, and whether or not the car was in a school zone and the date of the violation. Additionally, you will collect information about the driver (see output for specifics). The way speeding tickets are computed differs from city to city. For this assignment, we will use these rules, which need to be applied in this order:
Computers and Technology
1 answer:
Nonamiya [84]3 years ago
3 0

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 float speedlimit, actualspeed;

 String ddate;

 int schoolzone;

 System.out.print("Speed Limit: ");

 speedlimit = input.nextFloat();

 System.out.print("Actual Speed: ");

 actualspeed = input.nextFloat();

 System.out.print("Date: ");

 ddate = input.nextLine();

 System.out.print("School Zone (1-Yes): ");

 schoolzone = input.nextInt();

 float ticket = 75;

 ticket += 6 * (actualspeed - speedlimit);

 

 if(actualspeed - speedlimit > 30){

     ticket+=160;

 }

 if(schoolzone == 1){

     ticket*=2;

 }  

 System.out.print("Date: "+ddate);

 System.out.print("Speed Limit: "+speedlimit);

 System.out.print("Actual Speed: "+actualspeed);

 System.out.print("Ticket: "+ticket);

}

}

Explanation:

See attachment for complete program requirements

This declares speedlimit and actualspeed as floats

float speedlimit, actualspeed;

This declares ddate as string

 String ddate;

This declares schoolzone as integer

 int schoolzone;

This prompts the user for speed limit

 System.out.print("Speed Limit: ");

This gets the speed limit

 speedlimit = input.nextFloat();

This prompts the user for actual speed

 System.out.print("Actual Speed: ");

This gets the actual speed

 actualspeed = input.nextFloat();

This prompts the user for date

 System.out.print("Date: ");

This gets the date

 ddate = input.nextLine();

This prompts the user for school zone (1 means Yes, other inputs means No)

 System.out.print("School Zone (1-Yes): ");

This gets the input for schoolzone

schoolzone = input.nextInt();

This initializes ticket to $75

 float ticket = 75;

This calculates the additional cost based on difference between speed limits and the actual speed

 ticket += 6 * (actualspeed - speedlimit);

If the difference between the speeds is greater than 30, this adds 160 to the ticket  

<em>  if(actualspeed - speedlimit > 30){</em>

<em>      ticket+=160;</em>

<em>  }</em>

If it is in a school zone, this doubles the ticket

<em>  if(schoolzone == 1){</em>

<em>      ticket*=2;</em>

<em>  }  </em>

The following print the ticket information

<em>  System.out.print("Date: "+ddate);</em>

<em>  System.out.print("Speed Limit: "+speedlimit);</em>

<em>  System.out.print("Actual Speed: "+actualspeed);</em>

<em>  System.out.print("Ticket: "+ticket);</em>

<em />

You might be interested in
A technician is troubleshooting a Windows system in which an application works properly when the computer is booted in Safe Mode
sweet-ann [11.9K]

Answer:

yoooo nba BAD BAD

Explanation:

3 0
3 years ago
Which of the following are valid values for a String? (Select all that apply)
Ilya [14]

Answer:

"false" "PK fire" "17"

Explanation:

Strings are any values wrapped in speech marks.

6 0
4 years ago
___________allows you to see what the final web page will look like.​
sdas [7]

Answer:

date allow you to see what the final web

Explanation:

because data is common media of an

3 0
3 years ago
a mobile base in an urban environment has the power of 15 microW at 175 m. If the propagation follows an inverse cube power law,
Evgen [1.6K]

Answer: Power P at distance 0.7 km is: 0.234 µW

Explanation:

We know that

inverse cube-power law.

Thus Power, P = c / d³

Substituting we have

15 µW = c / (175 m)³

c = (15 µW) x (175 m)³

Then finally Power value at 0.7 km.

Will be

P = c / d³

P = ((15 µW) x (175 m)³) / (700 m)³

= (15 µW) x (175 / 700)³

= (15 µW) x (0.25)³

=(15 µW) x (0.015625)

P = 0.234 µW

8 0
4 years ago
I Promise Brainliest !!!!! Describe how the aperture size relates to the size of the lens opening.
sergey [27]

Answer:

As aperture increases in f-stop values, the lens closes. On the other hand, when aperture decreases in f-stop values, the lens opens.

Explanation:<u><em>plz give brainlist</em></u>

8 0
3 years ago
Read 2 more answers
Other questions:
  • A contractor is preparing a bid to install swimming pools at a new housing addition. The estimated time to build the first pool
    12·1 answer
  • )What item is at the front of the list after these statements are executed?
    8·1 answer
  • How Do I Make A Walk animation for a school Project?? Gifs?
    13·1 answer
  • Which statement about bump mapping and normal mapping is true?
    9·1 answer
  • Why would an information systems security practitioner want to see network traffic on both internal and external network traffic
    5·1 answer
  • Do you think<br> brain uploading<br> is a good idea?
    7·1 answer
  • What is meant by astigmation​
    9·2 answers
  • What defines the scope of a project?
    5·1 answer
  • Select the correct answer from the drop-down menu.
    14·1 answer
  • A(n) ________ portal offers a personalized, single point of access through a web browser to employees located inside and outside
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!