Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DaysOfMonthDriver {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter a month (1-12): ");//ask the user to input month
- int month = scan.nextInt();//scans the next input of integer from month
- System.out.println("Enter a year: ");//ask the user to input year
- int year = scan.nextInt();//scans the next input of integer from a year
- DaysOfMonth m = new DaysOfMonth(month, year);//creates and instantiates an object for month and year
- System.out.println("There are " + m.getNumOfDays() + " days");//prints and display the result by using a getter method to obtain number of days
- scan.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement