Advertisement
apez1

Term 1: Lesson 32 - Coding Activity 1

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