Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a help with writting this program, I found many similar programs on Chegg Study but none of them helping me out because here
I need a help with writting this program, I found many similar programs on Chegg Study but none of them helping me out because here output does not need getters...
Here is the program:
Here is the part of the code which needs to be included:
// This is a driver program to demonstrate how classes collaborate. public class ParkingTicketSimulator{ public static void main(String[] args){ // create a ParkedCar object, the car was parked for 125 minutes ParkedCar car = new ParkedCar("Volkswagen", "1972", "Red", "147RHZM", 125); // create a ParkingMeter object, 60 minutes were purchased ParkingMeter meter = new ParkingMeter(60); // create a PoliceOfficer object PoliceOfficer officer = new PoliceOfficer("Joe Friday", "4788"); // create a ParkingTicket object ParkingTicket ticket = new ParkingTicket(car, meter, officer, car.getMinutesParked()-meter.getMinutesPurchased()); // print Parking ticket information if(ticket.getFine() > 0) System.out.println(ticket); else System.out.println("No ticket issued!"); } }Problem Statement Create a new package named program2 in Eclipse (the project name can be 112 or whatever you have), and put all the classes for this programming assignment in this package (right-click on a projectNew Package, type program 2 as the package name). For this assignment, you will design a set of classes that work together to simulate a police officer issuing a parking ticket. You should design the following classes: . The ParkedCar class: This class should simulate a parked car. The class's responsibilities are as follows: -To know the car's make, model, color, license number, and the number of minutes that the car has been parked ParkedCar make String model : String color: String licenceNumber: String minutesParked: int ParkedCar (mk:String, md : String, cl: String, In ParkedCar (object2: ParkedCar) String, mp: int) +setters here +getters here . The ParkingMeter class: This class should simulate a parking meter The class's only responsibility is as follows: - To know the number of minutes of parking time that has been purchased. minutesPurchased: int ParkingMeter (mp : int) ParkingMeter (object2: ParkingMeter) + setter here + getter here +toStrin Cont'd on next page
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