Speeding Tickets solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (3 votes)

There are two types of speeding tickets in Maryland – “Payable” and “Must Appear”. “Payable” tickets can be paid by mail, in person or online. “Must Appear” tickets require the violator to appear at the County Court House in addition to paying a fine.
The DMV has asked you to build an application that will calculate the fees for a speeding tickets and then print a notice that will be mailed to the violator.

• UML diagram, class diagrams
• Java fundamentals, including decision structures, loops
• Constructors, Overloaded constructors
• toString method
• Formatting output with DecimalFormat
• Random Class
• Java objects & classes
• Following a Javadoc

Data Element Class – Ticket
• Student Created
• Include private instance variables to store information needed for a ticket. Select the correct data types for each one. The speed and speed limit will be integers and that the school zone and work zone will be Boolean.
• A constructor that takes the name, speed, speed limit, school zone and work zone.
• Another constructor that takes the name, speed and speed limit. The school zone and work zone will be set to false.
• Getters and setters for the private instance variables.
• A public method calculateFine which calculates and returns the fine (as a double) based on the table in Assignment Details.
• A public method printNotice which returns a String with the contents of the Notice. Make sure that your fine is formatted in decimal format. Please see the Assignment Details for exact wording/format. Use your name instead of Professor Kartchner.
• A private method generateTicketNum which randomly generates a ticket number between 100000 and 999999 inclusively.
• A private method generateCourtDate which randomly generates a day between 1 and 31 inclusively. All court dates will take place in October 2018.
• A private method ticketType which returns a string of either “Payable” or “Must Appear” based on the table in Assignment Details.
• A toString method that returns a string representation of a Ticket, including the ticket number and ticket type. No specific format required.
• The method headers must match the Javadoc provided for you for the Ticket class.

Driver Class – TicketDriver
• Student created
• This is the driver class for Ticket that contains a main method.
• The driver is responsible to:
o print a header
o ask the user for information about a ticket.
o Print out the notice for that ticket using the methods from the Ticket class.
o Allow user to add another ticket.
o When user is finished entering tickets, prints “Exiting the Ticket Manager”
o Refer to the program sample run for more clarification.
• Data Validation. The following data must be validated:
o Speed > 0
o Speed Limit >0 and <= 80 • Add any necessary methods to modularize your code. GUI Driver Class – TicketGUIDriver • Provided • Uses methods of the ticket class • Use as a way to test your cacluateFine and printNotice methods • Introduction to a Graphical User Interface (GUI) driver • Include the dmv.jpg in the same package as your .java files for the image to display. Test Class – TicketTestDriver • Provided • This is the driver class for testing the methods of the Ticket class. This has been given to you to help you test the methods of your Ticket class.   The fines will be based on the following: Take screenshots of two runs of your program with different data. Here is an example of the notice based on the following data: Name: John Smith Speed: 41 Speed Limit: 35 School Zone: Yes Work Zone: No Department of Motor Vehicles Automated Traffic Enforcement Dear John Smith, Please pay the following speeding fine of $200.00 to the DMV within 10 days of receiving this notice to avoid a driver’s license suspension. You are being fined for going 41 MPH in a 35 MPH school zone. Ticket Type: PAYABLE Ticket Number: 482957 Returned checks are subject to a returned check fee of $35.00. Sincerely, Professor Kartchner (put your name here) Here is an example of the notice based on the following data: Name: Betty Boop Speed: 58 Speed Limit: 25 School Zone: No Work Zone: Yes Department of Motor Vehicles Automated Traffic Enforcement Dear Betty Boop, Please pay the following speeding fine of $450.00 to the DMV within 10 days of receiving this notice to avoid a driver’s license suspension. You are being fined for going 58 MPH in a 25 MPH work zone. Ticket Type: MUST APPEAR You must appear at the County Court House on October 5, 2018 Ticket Number: 936826 Returned checks are subject to a returned check fee of $35.00. Sincerely, Professor Kartchner (put your name here) **Do not use color, this is for demo purposes only Sample 1 – shows multiple tickets being processed in one run Ticket Manager Enter the name of the violator: Poe Dameron Enter the speed of the violator (>0): 54
Enter the speed limit (>0,<=80): 30 Was this in a school zone (Y/N): N Was this in a work zone (Y/N): N Department of Motor Vehicles Automated Traffic Enforcement Dear Poe Dameron, Please pay the following speeding fine of $495.00 to the DMV within 10 days of receiving this notice to avoid a driver's license suspension. You are being fined for going 54 MPH in a 30 MPH zone Ticket Type: PAYABLE Ticket Number: 161624 Returned checks are subject to a returned check fee of $35.00 Sincerely Professor Kartchner Do you want to enter another ticket? (Y/N)Y Enter the name of the violator: Kylo Ren Enter the speed of the violator (>0): 86
Enter the speed limit (>0,<=80): 45 Was this in a school zone (Y/N): Y Was this in a work zone (Y/N): N Department of Motor Vehicles Automated Traffic Enforcement Dear Kylo Ren, Please pay the following speeding fine of $675.00 to the DMV within 10 days of receiving this notice to avoid a driver's license suspension. You are being fined for going 86 MPH in a 45 MPH school zone Ticket Type: MUST APPEAR You must appear at the County Court House on October 16, 2018. Ticket Number: 737022 Returned checks are subject to a returned check fee of $35.00 Sincerely Professor Kartchner Do you want to enter another ticket? (Y/N)N Exiting the Ticket Manager Sample 2 – shows validation loops Ticket Manager Enter the name of the violator: Han Solo Enter the speed of the violator (>0): -25
Enter the speed of the violator (>0): 59
Enter the speed limit (>0,<=80): -20 Enter the speed limit (>0,<=80): 85 Enter the speed limit (>0,<=80): 45 Was this in a school zone (Y/N): yes Was this in a school zone (Y/N): Y Was this in a work zone (Y/N): no Was this in a work zone (Y/N): N Department of Motor Vehicles Automated Traffic Enforcement Dear Han Solo, Please pay the following speeding fine of $310.00 to the DMV within 10 days of receiving this notice to avoid a driver's license suspension. You are being fined for going 59 MPH in a 45 MPH school zone Ticket Type: PAYABLE Ticket Number: 890645 Returned checks are subject to a returned check fee of $35.00 Sincerely Professor Kartchner Do you want to enter another ticket? (Y/N)N Exiting the Ticket Manager Example of Ticket GUI Driver: Deliverables / Submissions: Design: UML class diagram with algorithm (pseudo-code) for methods Implementation: Submit a compressed file containing the follow (see below): The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below. Be sure to review the provided project rubric to understand project expectations. The write-up will include: • Test Cases o Prepare a test table with a list of test cases (expected versus actual results) that you are testing the application with. There must be at least 4 sets of valid data and at least one set of invalid data. o Screenshots of at least two of the test cases in your test table. • UML diagram • In three or more paragraphs, highlights of your learning experience Deliverable format: The above deliverables will be packaged as follows. Two compressed files in the following formats: • LastNameFirstName_Assignment5_Complete.zip, a compressed file in the zip format, with the following: o Write up (Word document) - reflection paragraphs, test cases, screenshots o UML Diagram - latest version (Word or jpg document) o doc (directory) - Javadoc • File1.html (example) • File2.html (example) o src (directory) • File1.java (example) • File2.java (example) • LastNameFirstName_Assignment5_Moss.zip, a compressed file containing one or more Java files: o File1.java (example) o File2.java (example) This folder should contain Java source files only