My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package com.lineadecodigo.java.basico;

import java.util.Scanner;


/**
* @file SignoZodiaco.java
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 6-agosto-2010
* @url http://lineadecodigo.com/java/calcular-signo-del-zodiaco-con-java/
* @description Programa que dada una fecha nos ayuda a saber cuál es nuestro signo del zodiaco. Utilización de swith.
*/

public class SignoZodiaco {

public static void main(String[] args) {


int dia = 1;
int mes = 1;

Scanner reader = new Scanner(System.in);

System.out.println("Qué día naciste");
dia = reader.nextInt();

System.out.println("Qué mes naciste");
mes = reader.nextInt();

switch(mes) {
case 1:
if (dia>=21)
System.out.println("Acuario");
else
System.out.println("Capricornio");
break;
case 2:
if (dia>=20)
System.out.println("Piscis");
else
System.out.println("Acuario");
break;
case 3:
if (dia>=21)
System.out.println("Aries");
else
System.out.println("Piscis");
break;
case 4:
if (dia>=21)
System.out.println("Tauro");
else
System.out.println("Aries");
break;
case 5:
if (dia>=21)
System.out.println("Geminis");
else
System.out.println("Tauro");
break;
case 6:
if (dia>=21)
System.out.println("Cancer");
else
System.out.println("Geminis");
break;
case 7:
if (dia>=23)
System.out.println("Leo");
else
System.out.println("Cancer");
break;
case 8:
if (dia>=23)
System.out.println("Virgo");
else
System.out.println("Leo");
break;
case 9:
if (dia>=23)
System.out.println("Libra");
else
System.out.println("Virgo");
break;
case 10:
if (dia>=23)
System.out.println("Escorpio");
else
System.out.println("Libra");
break;
case 11:
if (dia>=23)
System.out.println("Sagitario");
else
System.out.println("Escorpio");
break;
case 12:
if (dia>=22)
System.out.println("Capricornio");
else
System.out.println("Sagitario");
break;
default:
System.out.println("Mes no existente");
}


}

}

Change log

r270 by vcuervo on Aug 8, 2010   Diff
Signo Zodico con Java
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 2320 bytes, 111 lines
Powered by Google Project Hosting