Question
IN JAVA: Object-Oriented Design, JUnit Testing and Git Lab Objectives Be able to use objects made up of other objects Be able to implement the
IN JAVA:
Object-Oriented Design, JUnit Testing and Git Lab Objectives
Be able to use objects made up of other objects
Be able to implement the classes designed
Be able to design methods Be able to follow given requirements exactly
Be able to write JUnit Tests for each class defined
Be able to use Git to store versioned files and retrieve files/changes submitted from other contributors
Introduction
For this lab you will design a set of classes that work together to simulate a police officer issuing a parking ticket. Think of these classes as a feature that you have been instructed to add to the live production program that is running for the company that employs you. This means that you need to meet the specifications that you are given exactly as required or it could bring down the entire company site. The classes you should design are:
The ParkedCar Class: This class should simulate a parked car. The classs responsibilities are:
o To know the cars make, model, color, license number.
The ParkingMeter Class: This class should simulate a parking meter. The classs only responsibility is:
o To know the number of minutes of parking time remaining.
The ParkingTicket Class: This class should simulate a parking ticket. The classs responsibilities are:
o To report the year, make, model, color, and license number of the illegally parked car.
o To report the amount of the fine, which is $25.
o To report the name and badge number of the police officer issuing the ticket.
The PoliceOfficer Class: This class should simulate a police officer inspecting parked cars. The classs responsibilities are:
o To know the police officers name and badge number
o To examine a ParkingMeter object and determine the meters time has expired. If the meters time has expired, to issue a parking ticket (generate a ParkingTicket object) listing the ParkedCar objects information, the officers information, and the fine amount. If the meters time has not expired, no ticket is issued.
These classes can be represented with the following UML diagrams:
ParkingTicket -officer:PoliceOfficer -car:ParkedCar -FINE:int final +ParkingTicket(car:ParkedCar, officer:PoliceOfficer) + toString():String \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ ParkedCar } \\ \hline -year:int \\ -make:String \\ -model:String \\ -color:String \\ -license:String \\ \hline +ParkedCar(year:int, make:String, \\ model:String, color:String, license:String) \\ +ParkedCar(car:ParkedCar) \\ +toString():String \\ \hline \end{tabular} \begin{tabular}{|l|} \hline \multicolumn{1}{|l}{-name:String } \\ -badgeNumber:int \\ +PoliceOfficer(name:String, badge:int) \\ +oliceOfficer(officer:PoliceOfficer) \\ +patrol(meter:Ptring \\ car:ParkedCar):ParkingMeter, \\ \hline \end{tabular}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started