Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do {
- int monthName = generator.nextInt(12) + 1;
- System.out.print("\nWhat is the name of the month #"
- + monthName + "? ");
- String response = keyboard.next();
- Month m = new Month(monthName);
- //Below used to test second constructor
- System.out.println( m.getName() + " " + m.getNumber());
- if ( m.getName() .equals(response) ) {
- System.out.println("Correct! Very good!" +
- "\nThe correct name is" + " " + m + ".");
- } else {
- System.out.println("Sorry. Month #" + monthName + " is " + m);
- }
- //Same outputs produced
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement