Please help me with this exercises in JAVA, Thank you
=====================
Parking Ticket Simulator Assignment
=====================
For this assignment you will create a set of classes from scratch
(no provided class files for this assignment) that work together to
simulate a police officer issuing a parking ticket. You should
design the following classes / functionality within them:
=====================
ParkedCar.java:
=====================
This class should simulate a parked car. The class's
responsibilities are as follows:
- To store the car's make, model, color, license number, and the
number of minutes that the car has been parked.
=====================
ParkingMeter.java:
=====================
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.
=====================
PoliceOfficer.java:
=====================
This class should simulate a police officer inspecting
parked
cars. The class's responsibilities are as follows:
- To know the police officer's name and badge number
- To examine a ParkedCar object and a ParkingMeter object, and
determine whether the car's time has expired
- To issue a parking ticket (generate a ParkingTicket object) if
the car's time has expired
=====================
ParkingTicket.java:
=====================
This class should simulate a parking ticket - this class will contain a main() method that will set up a scenario to show a ParkingTicket being issued to a ParkedCar.
The class's responsibilities are as follows:
- To report the make, model, color, and license number of the
illegally parked car
- To report the amount of the fine, which is $25 for the first hour
or part of an hour that the car is illegally parked, plus $10 for
every additional hour or part of an hour that the car is illegally
parked
- To report the name and badge number of the police officer issuing
the ticket
Java Program:
File: ParkedCar.java
/* To store the car's make, model, color, license number, and
the number of minutes that the car has been parked */
class ParkedCar
{
private String make;
private String model;
private String color;
private String licenseNumber;
private int numMinutes;
//Constructor
ParkedCar(String make, String model, String color,
String lNum, int numM)
{
this.make = make;
this.model = model;
this.color = color;
this.licenseNumber = lNum;
this.numMinutes = numM;
}
//Getter method
public int getMinutesParked()
{
return numMinutes;
}
//Printing Car details
public String getCarDetails()
{
return ("\nMake: " + make +
"\nModel: " + model + "\nColor: " + color + "\nLicense Number: " +
licenseNumber + "\nNuber of minutes parked: " + numMinutes +
"\n");
}
}
File: ParkingMeter.java
/* To know the number of minutes of parking time that has been
purchased */
class ParkingMeter
{
private int minutesPurchased;
//Constructor
public ParkingMeter(int m)
{
minutesPurchased = m;
}
//Getter Method
public int getMinutesPurchased()
{
return minutesPurchased;
}
}
File: PoliceOfficer.java
/*To know the police officer's name and badge number
- To examine a ParkedCar object and a ParkingMeter object, and
determine whether the car's time has expired
- To issue a parking ticket (generate a ParkingTicket object) if
the car's time has expired */
class PoliceOfficer
{
private String name;
private String badge;
//Constructor
PoliceOfficer(String name, String badge)
{
this.name = name;
this.badge = badge;
}
//Method that returns the ticket
public String getPoliceOfficerDetails()
{
return ("\nOfficer Name: " +
this.name + "\nBadge: " + this.badge + "\n");
}
//Examine car
public int examine(ParkedCar pc, ParkingMeter
pm)
{
if (pc.getMinutesParked() >
pm.getMinutesPurchased())
{
return
(pc.getMinutesParked() - pm.getMinutesPurchased());
}
else
{
return 0;
}
}
}
File: ParkingTicket.java
/* Main class - To report the make, model, color, and license
number of the illegally parked car */
class ParkingTicket
{
public static void main(String[] args)
{
//Creating objects
ParkedCar pc = new
ParkedCar("Nexa", "SUV-200", "Blue", "LIC878787", 40);
ParkingMeter pm = new
ParkingMeter(30);
PoliceOfficer po = new
PoliceOfficer("Joe Deck", "B878");
//Examining car
int excessMinutesParked =
po.examine(pc, pm);
if (excessMinutesParked == 0)
{
System.out.println("\n No Fine... \n");
}
else
{
System.out.println("\n\n Illegally parked car: ");
System.out.println(pc.getCarDetails());
double
excessHours = excessMinutesParked / 60.0;
double
fine;
//Checking
number of hours
if (excessHours
< 1)
{
fine = 25;
}
else
{
fine = 25 + ( (excessHours - 1) * 10 );
}
//Printing
fine
System.out.printf("\n\n Fine Amount: $%.2f\n", fine);
System.out.println("\n\n Ticket Issuing Police Officer: ");
System.out.println(po.getPoliceOfficerDetails());
}
}
}
______________________________________________________________________________________________________
Sample Run:
Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment =====================...
For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should designare:• The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are:o To know the car’s make, model, color, license number, and the number of minutes that the car has been parked• The ParkingMeter Class: This class should simulate a parking meter. The class’s only responsibility is:o To know the number...
I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. 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. • ...
using java:
For this exercise, you will design a set of classes that work
together to simulate a parking officer checking a parked car
issuing a parking ticket if there is a parking violation. Here are
the classes that need to collaborate:
• The ParkedCar class: This class should
simulate a parked car. The car has a make, model, color, license
number. •The ParkingMeter class: This class should
simulate a parking meter. The class has three parameters:
− A 5-digit...
This is assignment and code from this site but it will not
compile....can you help?
home / study / engineering / computer science / computer science
questions and answers / c++ this assignment requires several
classes which interact with each other. two class aggregations
...
Question: C++ This assignment requires several classes
which interact with each other. Two class aggregatio...
(1 bookmark)
C++
This assignment requires several classes which interact with
each other. Two class aggregations are formed. The program...
This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...
Project: Parking Ticket Simulator Problem Description: For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should design are:
Use the description from Parking Ticket Simulator from Chapter 14 as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example in the PPT) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked beyond their time...
in java PART ONE ================================================== Write a program that will read employee earnings data from an external file and then sort and display that data. Copy and paste the input file data below into an external file, which your program will then read. You will want to use parallel arrays for this program. Modify the select sort algorithm to receive both arrays as parameters as well as the size of the arrays. Use the algorithm to sort your earnings array....
Car Instrument SimulatorFor this assignment, you will design a set of classes that work together to simulate a car’s fuel gauge andodometer. The classes you will design are the following: The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are as follows:o To know the car's current amount of fuel, in gallons.o To report the car s current amount of fuel, in gallons.o To be able to increment the amount of fuel by I gallon. This simulates...
Assignment 4 Due Mar 22 by 11:59pmPoints 100 Submitting a file upload A4 OOP 2 "Car Instrument Simulator" Access A4 from pdf assignment file & Turn in the following files: a4main.java FuelGauge.java Odometer.java program compile and run screenshots design document (including UML) A4 10. Car Instrument Simulator For this assignment, you will design a set of classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are the following: · The Pue|Gauge Class:...