Advertisement
BiggestEl

Untitled

Nov 27th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. do {
  2. int monthName = generator.nextInt(12) + 1;
  3. System.out.print("\nWhat is the name of the month #"
  4. + monthName + "? ");
  5. String response = keyboard.next();
  6. Month m = new Month(monthName);
  7. //Below used to test second constructor
  8. System.out.println( m.getName() + " " + m.getNumber());
  9. if ( m.getName() .equals(response) ) {
  10. System.out.println("Correct! Very good!" +
  11. "\nThe correct name is" + " " + m + ".");
  12. } else {
  13. System.out.println("Sorry. Month #" + monthName + " is " + m);
  14. }
  15.  
  16.  
  17. //Same outputs produced
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement