Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package cviko1;
- import java.util.Scanner;
- import java.util.*;
- /**
- *
- * @author xrener
- */
- public class Cviko1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- /*int cislo1 = 55;
- int cislo2 = 45;
- if(cislo1 < cislo2)
- {
- System.out.println("Cislo2 je vacsie ako cislo 1");
- }
- else if(cislo2 < cislo1)
- {
- System.out.println("Cislo1 je vacsie ako cislo2");
- }
- System.out.println("Hello World");*/
- /*Scanner input = new Scanner(System.in);
- int cislo1;
- int cislo2;
- System.out.println("Zadajte jedno cislo:");
- cislo1 = input.nextInt();
- System.out.println("Zadajte druhe cislo:");
- cislo2 = input.nextInt();
- if(cislo1 < cislo2)
- {
- System.out.println("Cislo "+cislo2+" je vacsie ako "+cislo1+" !");
- }
- else if(cislo2 < cislo1)
- {
- System.out.println("Cislo "+ cislo1 +" je vacsie ako "+ cislo2 +" !");
- }*/
- /*int den;
- Scanner input = new Scanner(System.in);
- System.out.println("Zadajte den narodenia:");
- den = input.nextInt();
- System.out.println("Zadajte mesiac narodenia:");
- mesiac = input.nextInt();*/
- /*switch(mesiac)
- {
- case 1:
- if(den >= 1 || den <= 20)
- {
- System.out.println("Horoskop: Kozorozec");
- }
- else if(den >= 21 || den <= 31)
- {
- System.out.println("Horoskop: Vodnar");
- }
- break;
- case 2:
- }*/
- Scanner input = new Scanner(System.in);
- int m;
- System.out.println("Zadajte mesiac: ");
- m = input.nextInt();
- ArrayList<String> mesiac = new ArrayList<String>();
- mesiac.add(null);
- mesiac.add(1, "Januar");
- mesiac.add(2, "Februar");
- mesiac.add(3, "Marec");
- mesiac.add(4, "April");
- mesiac.add(5, "Maj");
- mesiac.add(6, "Jun");
- mesiac.add(7, "Jul");
- mesiac.add(8, "August");
- mesiac.add(9, "September");
- mesiac.add(10, "Oktober");
- mesiac.add(11, "November");
- mesiac.add(12, "December");
- try{
- System.out.println("Vypis mesiace "+mesiac.get(m));
- }catch(IndexOutOfBoundsException error){
- System.out.println("Neznamy mesiac!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment