You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Locale;
public class PackageInfo {
private String name;
private String note;
private double price;
private double weight;
private boolean delivered;
private LocalDateTime expectedDate;
public PackageInfo(String name, String note, double price, double weight, boolean delivered, LocalDateTime expectedDate) {
this.name =name;
this.note = note;
this.price = price;
this.weight =weight;
this.delivered =delivered;
this.expectedDate = expectedDate;
}
public String getName() {
return name;
}
@Override
public String toString() {
DateFormat date = new SimpleDateFormat("yyyy-mm-dd hh:mm");
//date.setCalendar(expectedDate);
String isDelivered = delivered ? "yes" : "no";
//add remaining date
return "Name: " + name + "\n" + "Notes: " + note + "\n" + "Price: " + price + "\n" + "Weight: " + weight + "\n" + "Expected Delivery Date: " + expectedDate + "\n" + "Delivered? " + isDelivered;
}
}