Java Saved Program: placid-terrain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


import java.util.*;
import java.lang.*;
import java.io.*;
 
/* Name of the class has to be "Script" only */
class Script
{
	public static void main (String[] args)
	{
        int x;
        String mjesec = "";
        
	    Scanner s = new Scanner(System.in);
	    
	    System.out.println("Unesi broj 1 - 12!");
	    
	    x = s.nextInt;

        switch(x)
        {
            case 1: 
                mjesec = "January";
                break;
            case 2:
                mjesec = "February";
                break;
            case 3:
                mjesec = "March";
                break;
            case 4:
                mjesec = "April";
                break;
            case 5: 
                mjesec = "May";
                break;
            case 6:
                mjesec = "June";
                break;
            case 7:
                mjesec = "July";
                break;
            case 8:
                mjesec = "August";
                break;
            case 9: 
                mjesec = "September";
                break;
            case 10:
                mjesec = "Ocotber";
                break;
            case 11:
                mjesec = "November";
                break;
            case 12:
                mjesec = "December";
                break;
            default:
                System.out.println("Odabrali ste neodgovarajuci broj");
                break;
        }
        
        System.out.println(mjesec);
	}
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs