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.

81 lines
2.1 KiB

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.DateTimeException;
import java.time.LocalDateTime;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Scanner;
public class TextMenu {
private final String title = "title";
private final String[] options = new String []{
"List of all packages",
"Add a package",
"remove a package",
"list overdue packages",
"List upcoming packages",
"mark package as delivered",
"exit"};
public void display(){
int tag = title.length();
for (int i=0; i<= tag+3; i++){
System.out.print("#");
}
System.out.println("\n# " + title + " #");
for (int i=0; i<= tag+3; i++){
System.out.print("#");
}
DateFormat today = new SimpleDateFormat("yyyy-mm-dd");
Calendar cal=Calendar.getInstance();
System.out.println("\nToday is: " + today.format(cal.getTime()));
for (int i = 0; i < options.length; i++){
System.out.println(i+1 + ": " + options[i]);
}
}
public void list(ArrayList<PackageInfo> packageList){
}
public void add(ArrayList<PackageInfo> packageList){
Scanner scan = new Scanner(System.in);
String pName;
do {
System.out.println("enter package a valid name:");
pName = scan.nextLine();
}
while (pName.length()==0);
System.out.println("notes:");
String pNotes = scan.nextLine();
boolean checkDate = false;
while (checkDate == false) {
try {
System.out.println("enter date as yyyy-mm-dd hh-mm:");
LocalDateTime pDate = LocalDateTime.parse(scan.nextLine());
} catch (DateTimeParseException e) {
System.out.println("invalid date format");
}
checkDate = true;
}
}
public void remove(ArrayList<PackageInfo> packageList){
}
public void overDueList(ArrayList<PackageInfo> packageList){
}
public void upcomingList(ArrayList<PackageInfo> packageList){
}
public void markDelivered(ArrayList<PackageInfo> packageList){
}
}