Question: 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
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: 1. All tickets will start with a minimum amount of $75. 2. An additional $6 is charged for every mph over the posted speed limit. 3. If you are traveling over 30mph over the posted speed limit, an additional $160 is charged. 4. If the speeding occurred in a school zone, the cost of the ticket is doubled. You will then print the ticket on the output screen. This program is not concerned with checking for proper input. For example, if the posted speed limit is 55mph, and you were traveling 50mph, then a ticket would not be necessary in the first place. For this program, you can assume that the data will be entered correctly.
TICKET JAVA SHELL: public class Ticket { //Driver Information private String name, TDL, address, city, state, zip; //Violation Information private int postedSpeed, travelling, ticketAmount, day, month, year; private boolean schoolZone; public Ticket() { } public Ticket(String nm, String tdl, String addr, String cty, String st, String zp, int pSpd, int travel, int d, int m, int yr, String school) { } public void calcTicket() { } public String lastName() { return ""; } public String toString() { return""; } }
TICKET RUNNER JAVA SHELL: //Lab - import java.util.Scanner; import java.lang.System.*; public class TicketRunner { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("The Speeding Ticket Program"); System.out.println(); System.out.println("By: John Smith"); // Substitute your own name here. System.out.println(" ============================== "); // add code for input here // Instantiate and print System.out.println(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
