Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this code please write a Pseudo-Code for this code here is the code bellow a

ID: 3864221 • Letter: F

Question

For this code please write a Pseudo-Code for this code

here is the code bellow all classes are sperated by (====================)

=================ParkedCar.java================

public class ParkedCar {
  
   private String make;
   private String model;
   private String color;
   private String liscenceNo;
   private int minutesParked;
  
  
  
   public ParkedCar(String make, String model, String color,
           String liscenceNo, int minutesParked) {
       super();
       this.make = make;
       this.model = model;
       this.color = color;
       this.liscenceNo = liscenceNo;
       this.minutesParked = minutesParked;
   }
  
   public ParkedCar(ParkedCar car2){
      
   }
  
   public String getMake() {
       return make;
   }
   public void setMake(String make) {
       this.make = make;
   }
   public String getModel() {
       return model;
   }
   public void setModel(String model) {
       this.model = model;
   }
   public String getColor() {
       return color;
   }
   public void setColor(String color) {
       this.color = color;
   }
   public String getLiscenceNo() {
       return liscenceNo;
   }
   public void setLiscenceNo(String liscenceNo) {
       this.liscenceNo = liscenceNo;
   }
   public int getMinutesParked() {
       return minutesParked;
   }
   public void setMinutesParked(int minutesParked) {
       this.minutesParked = minutesParked;
   }
   @Override
   public String toString() {
       StringBuilder builder = new StringBuilder();
       builder.append(" Car:");
       builder.append(make);
       builder.append(" Model:");
       builder.append(model);
       builder.append(" Color:");
       builder.append(color);
       builder.append(" Plate:");
       builder.append(liscenceNo);
       builder.append(" minutesParked:");
       builder.append(minutesParked);
       return builder.toString();
   }
  
}

=============ParkingMeter.java=================

public class ParkingMeter {
  
   private int minutesPurchased;

   public ParkingMeter(int minutesPurchased) {
       super();
       this.minutesPurchased = minutesPurchased;
   }

   public int getMinutesPurchased() {
       return minutesPurchased;
   }

   public void setMinutesPurchased(int minutesPurchased) {
       this.minutesPurchased = minutesPurchased;
   }

}

============ParkingTicket.java=================

public class ParkingTicket {
  
   private ParkedCar car;
   private PoliceOfficer officer;
   private double fine;
   private int minutes;
  
   public static final double BASE_FINE=25.00;
   public static final double HOURLY_FINE=10.00;
  
  
   public ParkingTicket(ParkedCar car, PoliceOfficer officer, int minutes) {
       super();
       this.car = car;
       this.officer = officer;
       this.minutes = minutes;
   }
  
   public ParkingTicket(ParkingTicket ticket2){
      
   }
  
   public double calculateFine(){
      
       double hourlyFine = (minutes*HOURLY_FINE)/60;
       return BASE_FINE+hourlyFine;
   }

   public ParkedCar getCar() {
       return car;
   }

   public void setCar(ParkedCar car) {
       this.car = car;
   }

   public PoliceOfficer getOfficer() {
       return officer;
   }

   public void setOfficer(PoliceOfficer officer) {
       this.officer = officer;
   }

   public double getFine() {
       return fine;
   }

   public void setFine(double fine) {
       this.fine = fine;
   }

   public int getMinutes() {
       return minutes;
   }

   public void setMinutes(int minutes) {
       this.minutes = minutes;
   }

   @Override
   public String toString() {
       StringBuilder builder = new StringBuilder();
       builder.append(" CarData:");
       builder.append(car);
       builder.append(" Overtime:");
       builder.append(minutes);
       builder.append(" fine:");
       builder.append(fine);
       builder.append(" Police Officer:");
       builder.append(officer);
       return builder.toString();
   }
  
  
}

=============PoliceOfficer.java==============

public class PoliceOfficer {

   private String name;
   private String badgeNo;
  
   public PoliceOfficer(String name, String badgeNo) {
       super();
       this.name = name;
       this.badgeNo = badgeNo;
   }
  
   public PoliceOfficer(PoliceOfficer officer2){
      
   }
  
   public ParkingTicket patrol(ParkedCar car, ParkingMeter meter){
       ParkingTicket ticket = new ParkingTicket(car, this, meter.getMinutesPurchased());
       ticket.setFine(ticket.calculateFine());
      
       if(ticket.getFine()==0.00){
           return null;
       }
       return ticket;
   }
  
   public String getName() {
       return name;
   }
   public void setName(String name) {
       this.name = name;
   }
   public String getBadgeNo() {
       return badgeNo;
   }
   public void setBadgeNo(String badgeNo) {
       this.badgeNo = badgeNo;
   }

   @Override
   public String toString() {
       StringBuilder builder = new StringBuilder();
       builder.append(" name:");
       builder.append(name);
       builder.append(" badgeNo:");
       builder.append(badgeNo);
       return builder.toString();
   }
  
}

=================TestParking.java============

public class TestParkingTicket {
  
   public static void main(String[] args){
      
       // This 1986 Ford was parked for 85 minutes
   ParkedCar car = new ParkedCar("Ford", "1986", "Grey",
   "BAC4455", 85);
  
   // The meter had 30 minutes on it
   ParkingMeter meter = new ParkingMeter(30);
  
   PoliceOfficer officer = new PoliceOfficer("John Doe",
   "9932");
  
   // The officer is on patrol and sees the parked car
   // and the meter.
   // If the car was parked for a longer time than was
   // on the meter, then the "patrol" method will
   // issue a ticket.
   // If there was enough time on the meter to cover the
   // time the car was parked, then no ticket is
   // issued (i.e., a null reference is returned).
   ParkingTicket ticket = officer.patrol(car, meter);
  
   // If no ticket was issued, then "ticket" is null
   if (ticket == null)
   System.out.println("No crimes committed!");

   else
   {
   System.out.println("TICKET ISSUED: ");
   System.out.println(ticket);
   }
      
   }

}

Explanation / Answer

There are many ways to write PseudoCodes.

For the code given here, you are trying to find the duration of parking and
issue Ticket if its more than 30 minutes.

The pseudocode can be as follows:

ParkedCar.java

Create getters and setters to obtain the below information
car’s make, model, color, license number, and the number of
minutes that the car has been parked.

And override toString method to display the above information.

ParkingMeter.java

Create getters and setters to obtain information about the
number of minutes of parking time that has been purchased.

ParkingTicket.java

Create getters and setters for fine, number of minutes, instance of ParkedCar and
instance of PoliceOfficer

CalculateFine as below:
   double hourlyFine = (minutes*HOURLY_FINE)/60;
return BASE_FINE+hourlyFine;

And override toString method to display the above information.

PoliceOfficer.java

Create getters and setters to get and set the name of PoliceOfficer and Badge Number.

Function patrol to calculate the fine.

---------------------------------------------

Another way of writing PseudoCode is only for the Driver class because
the actual work happens there.

PseudoCode:

Create an instance of ParkedCar by specifying car’s make, model, color, license number, and the number of
minutes that the car has been parked

Use the ParkingMeter class to set the parking time in minutes.

Use the PoliceOfficer to set the PoliceOfficer name and badge number who is on duty.

The officer will do patrol.

He will check for ticket issued and calculates the fine as applicable.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote