/* * Intro to Programming CSE 1310 * University of Texas at Arlington */ package spr17mar21; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author jcmtiernan */ public class Spr17Mar21 { /** * @param args the command line arguments */ public static void main(String[] args) { Logger logger = Logger.getLogger(LoggingExamples.class.getName()); logger.setLevel(Level.OFF); //INFO is on; OFF is off Scanner keybd = new Scanner(System.in); JCMTtimeMar21 myTime = new JCMTtimeMar21(); JCMTtimeMar21 laterTime = new JCMTtimeMar21(); int inMo = -1; int inDay = -1; int inYr = -1; int inHr = -1; int inMin = -1; System.out.println("Please enter the expiration date and time of your coupon.\n"); System.out.println("The format should be month (space) day (space) year (space) hour (space) min"); System.out.println("like MM dd yyyy HH mm. The coupon year must be between 1970 and 2020. "); System.out.println("The hour should be in military time from 0 to 23. Invalid values will be "); System.out.println("replaced with the current time values. Example: For a coupon that expires one"); System.out.println("minute before midnight on Halloween the input would be 10 31 2017 23 59. \n"); System.out.print("Enter your coupon expiration date and time here: "); inMo = keybd.nextInt(); inDay = keybd.nextInt(); inYr = keybd.nextInt(); inHr = keybd.nextInt(); inMin = keybd.nextInt(); //myTime.MONTH = 9; System.out.println("\nYour input was "+inMo +"/"+inDay+"/"+inYr+" at "+inHr+":"+inMin); JCMTtimeMar21 expDate = new JCMTtimeMar21(inYr, inMo-1, inDay, inHr, inMin); System.out.println("Your error-checked input is "+expDate.toStringMDYHM()); System.out.println("\nNow we will check if this coupon is still valid and how many\n" + "days longer it is valid or that it has been expired. "); } }