Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

In Java Define a class called Infraction (i., an infraction is a violation) that defines the following attributes :

In Java Define a class called Infraction (i.e., an infraction is a violation) that defines the following attributes: amount - a float indicating how much the fine was for this infraction description - a String describing the infraction (e.g., "Not stopping for red light") dateIssued - a Date representing the date and time at which the infraction occurred. You must import java.util.Date in order for your code to compile. outstanding - a boolean indicating whether or not the infraction was paid yet driver - a Driver object representing the driver that received the infraction

Write the following in the Infraction class: 1. a proper constructor that takes 3 parameters for the first 3 attributes in the order shown above  a proper constructor that takes zero-parameters and calls the above constructor  a toString() method that returns a string with the format below (use the String.format() method to format the amount to 2 decimal places and to display the date/time. The portion of the format string for displaying the date is "%tc". If the infraction has been paid, it should state [PAID IN FULL] as shown, otherwise it should state [OUTSTANDING]): "$100.00 Infraction on Sun Jul 14 07:08:00 EDT 2002 [PAID IN FULL]"

 a method called pay() which pays the infraction (hint...use outstanding attribute)

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question