package cmpt213.assignment4.packagedeliveries.client.model; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * It's a subclass of PackageInfo that adds an expiry date */ public class PerishablePackage extends PackageInfo { LocalDateTime expiryDate; // It's a constructor that initializes the object with the given parameters. public PerishablePackage(String name, String note, double price, double weight, boolean delivered, LocalDateTime expectedDate, LocalDateTime expiryDate) { super(name, note, price, weight, delivered, expectedDate); this.expiryDate = expiryDate; this.setType("perishable"); } // It's a method that returns a string representation of the object. @Override public String toString() { return super.toString() + "\nExpiry date: " + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(expiryDate); } }