Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class DaysOfMonthDriver {
  5.  
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8.  
  9. System.out.println("Enter a month (1-12): ");//ask the user to input month
  10. int month = scan.nextInt();//scans the next input of integer from month
  11. System.out.println("Enter a year: ");//ask the user to input year
  12. int year = scan.nextInt();//scans the next input of integer from a year
  13. DaysOfMonth m = new DaysOfMonth(month, year);//creates and instantiates an object for month and year
  14. System.out.println("There are " + m.getNumOfDays() + " days");//prints and display the result by using a getter method to obtain number of days
  15.  
  16. scan.close();
  17.  
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement