Advertisement
apez1

Term 1: Lesson 32 - Coding Activity 2

Nov 23rd, 2018
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Lesson_32_Activity_Two {
  5.    
  6.     static Scanner scanner = new Scanner(System.in);
  7.    
  8.     public static void monthName(int input){
  9.        
  10.     String Months [] = { "January","February","March","April","May","June","July","August","September","October","November", "December"};
  11.        
  12.     System.out.println(Months[input-1]);
  13.  
  14.     }
  15.    
  16.     public static void monthDays(int input) {
  17.            
  18.     int monthDays [] = {31,28,31,30,31,30,31,31,30,31,30,31};
  19.    
  20.     System.out.println(monthDays[input-1]);
  21.     }
  22.    
  23.    
  24.     public static void main(String[] args) {
  25.          
  26.         System.out.println("What is the number of the month?");
  27.         int input = scanner.nextInt();
  28.         monthDays(input);  
  29.        
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement