Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Elektronisches_Quiz_II_lw {
- public static void main(String[] args) throws Exception{
- double x = Math.ceil(Math.random()*2);
- String joker [] = {"A: Konrad Adenauer, D: Ludwig Erhard","B: Kurt Georg Kiesinger, D: Ludwig Erhard","C: Willy Brandt, D: Ludwig Erhard"};
- wiederholen:for(;;){
- String auswahl1 = JOptionPane.showInputDialog("Wer war der 2. Bundeskanzler der Bundesrepublik Deutschland?\n"
- +"A: Konrad Adenauer, B: Kurt Georg Kiesinger, C: Willy Brandt, D: Ludwig Erhard, J: 50/50 Joker");
- switch(auswahl1){
- case "A":
- case "B":
- case "C": JOptionPane.showMessageDialog(null,"Falsch!");
- break wiederholen;
- case "D": JOptionPane.showMessageDialog(null,"Richtig!");
- break wiederholen;
- case "J":String auswahl2 = JOptionPane.showInputDialog(joker[(int)x]);
- switch(auswahl2){
- case "A":
- case "B":
- case "C": JOptionPane.showMessageDialog(null,"Falsch!");
- break wiederholen;
- case "D": JOptionPane.showMessageDialog(null,"Richtig!");
- break wiederholen;
- }
- default: continue wiederholen;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement