Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import javax.swing.*;
- import javax.swing.JOptionPane;
- public class Mundial {
- public static void main(String[] args) {
- int menu;
- Scanner entrada = new Scanner (System.in);
- String pregunta1="¿Quien ganó la copa mundial en 2010?";
- String respuesta_1_1="España";
- String respuesta_1_2="Francia";
- String respuesta_1_3="Alemania";
- String respuesta_1_4="Uruguay";
- int opcion_correcta1=1;
- String pregunta2="¿Quien obtuvo el balon de oro en el mundial de 2014?";
- String respuesta_2_1="Cristiano Ronaldo";
- String respuesta_2_2="Diego Forlan";
- String respuesta_2_3="Lionel Messi";
- String respuesta_2_4="David Beckham";
- int opcion_correcta2=3;
- String pregunta3="¿Cual es la longitud (en metros) de los arcos usados en el mundial 2014?";
- String respuesta_3_1="7,32";
- String respuesta_3_2="10,23";
- String respuesta_3_3="8,49";
- String respuesta_3_4="4,57";
- int opcion_correcta3=1;
- String pregunta4="¿En que año nacio Cristiano Ronaldo?";
- String respuesta_4_1="1987";
- String respuesta_4_2="1991";
- String respuesta_4_3="1985";
- String respuesta_4_4="1976";
- int opcion_correcta4=3;
- String pregunta5="¿En que estadio Uruguay le gano a brasil logrando ser campeones del mundo?";
- String respuesta_5_1="1946";
- String respuesta_5_2="1956";
- String respuesta_5_3="1950";
- String respuesta_5_4="1948";
- int opcion_correcta5=3;
- String pregunta6="¿Actualmente quien lleva el apodo de El pistolero uruguayo?";
- String respuesta_6_1="Diego Forlan";
- String respuesta_6_2="Luis Suarez";
- String respuesta_6_3="Diego Lugano";
- String respuesta_6_4="Edinson Cavani";
- int opcion_correcta6=2;
- String pregunta7="¿Quien fue el director tecnico de la seleccion uruguaya en el año 2010?";
- String respuesta_7_1="Washintong Tabarez";
- String respuesta_7_2="Jorge Da Silva";
- String respuesta_7_3="Marcelo Gallardo";
- String respuesta_7_4="Manuel Keosseian";
- int opcion_correcta7=1;
- String pregunta8="¿Como se llama el estadio en donde se jugo la final del Mundial 2014?";
- String respuesta_8_1="Arena de São Paulo";
- String respuesta_8_2="Estadio Nacional";
- String respuesta_8_3="Estadio das Dunas";
- String respuesta_8_4="Maracana";
- int opcion_correcta8=4;
- String pregunta9="¿En donde se jugo la primera Copa Mundial?";
- String respuesta_9_1="Brasil";
- String respuesta_9_2="Argentina";
- String respuesta_9_3="España";
- String respuesta_9_4="Uruguay";
- int opcion_correcta9=4;
- String pregunta10="¿Cual es el nombre completo de Messi?";
- String respuesta_10_1="Lionel Sebastian Messi Vazquez";
- String respuesta_10_2="Lionel Santiago Messi Ficolini";
- String respuesta_10_3="Lionel Andrés Messi Cuccittini";
- String respuesta_10_4="Lionel Messi Silvera";
- int opcion_correcta10=3;
- String pregunta_actual="";
- String respuesta_actual1="";
- String respuesta_actual2="";
- String respuesta_actual3="";
- String respuesta_actual4="";
- int opcion_correcta=0;
- String respuesta_verificar="";
- int inicio=1;
- int limite=10;
- int ultimo=0;
- int opcion_ok=0;
- int cant_respuestas_correctas=0;
- int cant_respuestas_incorrectas=0;
- for(int x=0;x<10;x++)
- {
- int aleatorio=0;
- do
- {
- System.out.println("Menú de opciones\n\n1-Jugar \n2-Descripcion \n3-Puntajes \n4-Creditos");
- menu = entrada.nextInt();
- aleatorio= inicio + (int) (Math.random() * ((limite + 1) - inicio));
- }while(ultimo==aleatorio);
- ultimo=aleatorio;
- switch(aleatorio)
- {
- case 1:
- pregunta_actual=pregunta1;
- respuesta_actual1=respuesta_1_1;
- respuesta_actual2=respuesta_1_2;
- respuesta_actual3=respuesta_1_3;
- respuesta_actual4=respuesta_1_4;
- opcion_ok=opcion_correcta1;
- break;
- case 2:
- pregunta_actual=pregunta2;
- respuesta_actual1=respuesta_2_1;
- respuesta_actual2=respuesta_2_2;
- respuesta_actual3=respuesta_2_3;
- respuesta_actual4=respuesta_2_4;
- opcion_ok=opcion_correcta2;
- break;
- case 3:
- pregunta_actual=pregunta3;
- respuesta_actual1=respuesta_3_1;
- respuesta_actual2=respuesta_3_2;
- respuesta_actual3=respuesta_3_3;
- respuesta_actual4=respuesta_3_4;
- opcion_ok=opcion_correcta3;
- break;
- case 4:
- pregunta_actual=pregunta4;
- respuesta_actual1=respuesta_4_1;
- respuesta_actual2=respuesta_4_2;
- respuesta_actual3=respuesta_4_3;
- respuesta_actual4=respuesta_4_4;
- opcion_ok=opcion_correcta4;
- break;
- case 5:
- pregunta_actual=pregunta5;
- respuesta_actual1=respuesta_5_1;
- respuesta_actual2=respuesta_5_2;
- respuesta_actual3=respuesta_5_3;
- respuesta_actual4=respuesta_5_4;
- opcion_ok=opcion_correcta5;
- break;
- case 6:
- pregunta_actual=pregunta6;
- respuesta_actual1=respuesta_6_1;
- respuesta_actual2=respuesta_6_2;
- respuesta_actual3=respuesta_6_3;
- respuesta_actual4=respuesta_6_4;
- opcion_ok=opcion_correcta6;
- break;
- case 7:
- pregunta_actual=pregunta7;
- respuesta_actual1=respuesta_7_1;
- respuesta_actual2=respuesta_7_2;
- respuesta_actual3=respuesta_7_3;
- respuesta_actual4=respuesta_7_4;
- opcion_ok=opcion_correcta7;
- break;
- case 8:
- pregunta_actual=pregunta8;
- respuesta_actual1=respuesta_8_1;
- respuesta_actual2=respuesta_8_2;
- respuesta_actual3=respuesta_8_3;
- respuesta_actual4=respuesta_8_4;
- opcion_ok=opcion_correcta8;
- break;
- case 9:
- pregunta_actual=pregunta9;
- respuesta_actual1=respuesta_9_1;
- respuesta_actual2=respuesta_9_2;
- respuesta_actual3=respuesta_9_3;
- respuesta_actual4=respuesta_9_4;
- opcion_ok=opcion_correcta9;
- break;
- case 10:
- pregunta_actual=pregunta10;
- respuesta_actual1=respuesta_10_1;
- respuesta_actual2=respuesta_10_2;
- respuesta_actual3=respuesta_10_3;
- respuesta_actual4=respuesta_10_4;
- opcion_ok=opcion_correcta10;
- break;
- }
- respuesta_verificar=JOptionPane.showInputDialog("Pregunta...."+(x+1)+"\n"+pregunta_actual+"\nIngrese su Respuesta:\n1. "+respuesta_actual1+"\n2. "+respuesta_actual2+"\n3."+respuesta_actual3+"\n4."+respuesta_actual4);
- opcion_correcta=Integer.parseInt(respuesta_verificar);
- if(opcion_correcta1==opcion_ok)
- {
- cant_respuestas_correctas++;
- }
- else
- {
- cant_respuestas_incorrectas++;
- }
- }
- JOptionPane.showMessageDialog(null,"¡Usted ha anotado " + cant_respuestas_correctas + " puntos!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement