-
-
Save JoaquinJimenezGarcia/e70715a268e88b028101eea9d1118f4d to your computer and use it in GitHub Desktop.
Calculadora CoC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Coc { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
String tropa, hecho; | |
int total, cantidad; | |
String[] tropas = {"Barbaro","Arquera","Gigante","Mago","Dragón","Pekka","Esqueleto","Goblin","Globo","Sanadora"}; | |
int[] costes = {200,400,3000,3500,33000,36000,3000,100,3500,10000}; | |
System.out.println("#######################################"); | |
System.out.println("### CALCULADORA DE CLASH OF CLANS ###"); | |
System.out.println("#######################################"); | |
System.out.println("### ###"); | |
System.out.println("### Calcula tus costes ###"); | |
System.out.println("### de tropas ###"); | |
System.out.println("### ###"); | |
System.out.println("#######################################"); | |
do{ | |
System.out.println("\nElige tropa:\n"); | |
for (int i = 0; i < tropas.length; i++) { | |
System.out.println(tropas[i] + " | " + costes[i]); | |
} | |
tropa = input.nextLine(); | |
System.out.println("\nElige cantidad:\n"); | |
cantidad = input.nextInt(); | |
switch (tropa) { | |
case "barbaro": | |
total = cantidad * 200; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "arquera": | |
total = cantidad * 400; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "gigante": | |
total = cantidad * 3000; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "mago": | |
total = cantidad * 3500; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "dragon": | |
total = cantidad * 33000; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "pekka": | |
total = cantidad * 36000; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "esqueleto": | |
total = cantidad * 3000; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "goblin": | |
total = cantidad * 100; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "globo": | |
total = cantidad * 3500; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
case "sanadora": | |
total = cantidad * 10000; | |
System.out.println("Coste total: " + total + " de elixir"); | |
break; | |
default: | |
System.out.println("!Opción incorrecta!"); | |
break; | |
} | |
}while(tropa != "hecho"); | |
System.out.println("Suerte y a la batalla"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment