public void addCourse(String name, int hours) { Scanner x= new Scanner(System.in); System.out.println("Please Enter Name: "); do { name = x.nextLine(); } while (name.isEmpty() ); System.out.println("Plase Enter Hours: "); hours = x.nextInt(); do { hours = x.nextInt(); } while (hours > 3 && hours < 1 ); Course e = new Course(name,hours); list.add(e); }