Results 1 to 5 of 5
  1. #1
    MD1993 is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default HELP - Java quiz application won't run

    hi, i'm a student and quite new to java, our assignment was to create a Java quiz program....below is the quiz program i have created, however, i can't get it to run in eclipse, all i get is an error saying 'IO cannot be resolved'...i have no idea how to get it to compile/run, help would be much appreciated :D thanks in advance
    Java Code:
    import java.util.Scanner;
    /* 
       
    */ 
    public class pubQuiz
    {
      /*
    
      */
      public static void main (String [] args)
      {
          
          
          int questionOne=0;
          int questionTwo=0;
          int questionThree=0;
          int questionFour=0;
          int questionFive=0;
          int questionSix=0;
          int questionSeven=0;
          int questionEight=0;
          int questionNine=0;
          int questionTen=0;
          int questionEleven=0;
          int questionTwelve=0;
          int questionThirteen=0;
          int questionFourteen=0;
          int questionFifteen=0;
          int questionSixteen=0;
          int questionSeventeen=0;
          int questionEighteen=0;
          int questionNineteen=0;
          int questionTwenty=0;
          int questionTwentyone=0;
          int questionTwentytwo=0;
          int questionTwentythree=0;
          int questionTwentyfour=0;
          int questionTwentyfive=0;
          int score=0;
          String operation;
          
          
          
          
          
          
          
          
          String teamName = IO.readString("What is your name?");
          
          
          
          
          
          
          
          
          
         
          
          String operationOne = IO.readString("[Sport] What is the official national sport of Bulgaria?  \n (a) Boxing, \n (b) Football,\n (c) Weightlifting, \n please choose a, b or c");
          
          
          String operationTwo = IO.readString("[Sport]  Which country won the first Cricket World Cup in 1975?  \n (a) Australia, \n (b) West Indies, \n (c) Pakistan,  \n  please choose a, b or c");
          
          
          String operationThree = IO.readString("[Sport] In the game of golf what is a mulligan?  \n (a) one shot over par, \n (b) free shot, \n (c) a lost ball,   \n   please choose a, b or c");
          
          
          String operationFour = IO.readString("[Sport] Which Football team plays their home games at Craven Cottage? \n (a) Fulham, \n (b) Chelsea, \n (c) Crystal Palace,  \n   please choose a, b or c");
          
          
          String operationFive = IO.readString("[Sport] In which American sport do the San Francisco 49ers play? \n (a) Baseball, \n (b) Ice Hockey, \n (c) American Football, \n  please choose a, b or c");
          
          
          String operationSix = IO.readString("[Television] Which country has won the Eurovision song contest more than any other country? \n (a) Belgium, \n (b) United Kingdom, \n (c) Irealnd,  \n please choose a, b or c");
           
           
          String operationSeven = IO.readString("[Television] On TV, where would you find Chief Wiggum? \n (a) South Park, \n (b) The Simpsons, \n (c) Family Guy, \n please choose a, b or c");
            
            
          String operationEight = IO.readString("[Television] WHich car was used as a time machine in the movies 'Back To The Future'? \n (a) a Lamborghini, \n (b) a Toyota, \n (c) a DeLorean, \n please choose a, b or c");
             
             
          String operationNine = IO.readString("[Television] Which was the first official James Bond film? \n (a) Doctor No, \n (b) On Her Majesty's Secret Service, \n (c) Goldfinger,  \n please choose a, b or c");
              
              
          String operationTen = IO.readString("[Television] In which classic British comedy do the characters Polly and The Major both appear? \n (a) Fawlty Towers, \n (b) Only Fools And Horses, \n (c) On The Buses, \n please choose a, b or c");
               
               
          String operationEleven = IO.readString("[Music] Who had the best selling single in Europe in 1987 with Never Gonna Give You Up? \n (a) Cliff Richards, \n (b) Rick Astley, \n (c) Tom Jones,  \n please choose a, b or c");
                
          
          String operationTwelve = IO.readString("[Music] the national anthem 'Bilady, Bilady, Bilady' is the national anthem of which North African Country \n (a) Egypt, \n (b) Morocco, \n (c) Libya, \n please choose a, b or c");
                 
                 
          String operationThirteen = IO.readString("[Music] Who did Rihanna collaborate with for the single 'What's my name?' \n (a) Drake, \n (b) Eminem, \n (c) Akon, \n please choose a, b or c");
          
          
          String operationFourteen = IO.readString("[Music] Who had a hit in the 00s with 'Mercy'? \n (a) Cheryl Cole, \n (b) Madonna, \n (c) Duffy, \n please choose a, b or c");
           
           
          String operationFifteen = IO.readString("[Music] Which country does singer Rihanna come from? \n (a) Barbados, \n (b) North America, \n (c) Brazil, \n please choose a, b or c");
            
            
          String operationSixteen = IO.readString("[General Knowledge] The flag of which country has the Star of David? \n (a) Israel, \n (b) China, \n (c) Belize, \n please choose a, b or c");
             
             
          String operationSeventeen = IO.readString("[General Knowledge] Which of the following countries is landlocked? \n (a) Mexico, \n (b) Russia, \n (c) Switzerland, \n please choose a, b or c");
              
              
          String operationEighteen = IO.readString("[General Knowledge] Which of the following is not a gas? \n (a) Mercury, \n (b) Helium, \n (c) Oxygen, \n please choose a, b or c");
               
               
          String operationNineteen = IO.readString("[General Knowledge]  Who is the patron saint of Australia? \n (a) Mary Help of Christians, \n (b) St Paul, \n (c) St Rock,  please choose a, b or c");
                
                
          String operationTwenty = IO.readString("[General Knowledge]  What type of animal is a 'skink'?  \n (a) Whale, \n (b) Frog, \n (c) Lizard, \n please choose a, b or c");
                 
                 
          String operationTwentyone = IO.readString("[Geography] Which river separates Cornwall from Devon? \n (a) River Thames, \n (b) River Tamar, \n (c) River Severn, \n please choose a, b or c");
                  
                  
          String operationTwentytwo = IO.readString("[Geography]  In which country are the Angel Falls, the world’s highest waterfall? \n (a) Bolivia, \n (b) Argentina, \n (c) Peru, \n please choose a, b or c");
                   
                   
          String operationTwentythree = IO.readString("[Geography] What is the capital of the Falkland Islands? \n (a) Camp Verde, \n (b) Smithtown, \n (c) Stanley, \n please choose a, b or c");
                    
            
          String operationTwentyfour = IO.readString("[Geography] Dulles International Airport serves which American city? \n (a) Miami, \n (b) Atlanta, \n (c) Washington, \n please choose a, b or c");
                     
                     
          String operationTwentyfive = IO.readString("[Geography]  In which country is the Province of Lapland to be found? \n (a) Finland, \n (b) Norway, \n (c) Sweden, \n please choose a, b or c");
          
          
          
          
          
          
          
          
          
          
          if(operationOne .equals("c")){
          	      score = score + 1;
          
          } if(operationTwo .equals("b")){
          	      score = score + 1;
          
          } if(operationThree .equals("b")){
          	      score = score + 1;
         
          } if(operationFour .equals("a")){
              score = score + 1;
              
          } if(operationFive .equals("c")){
              score = score + 1;
              
          } if(operationSix .equals("c")){
              score = score + 1;
              
          } if(operationSeven .equals("b")){
              score = score + 1;
              
          } if(operationEight .equals("c")){
              score = score + 1;
              
          } if(operationNine .equals("a")){
              score = score + 1;
              
          } if(operationTen .equals("a")){
              score = score + 1;
              
          } if(operationEleven .equals("b")){
              score = score + 1;
              
          } if(operationTwelve .equals("a")){
              score = score + 1;
              
          } if(operationThirteen .equals("a")){
              score = score + 1;
              
          } if(operationFourteen .equals("c")){
              score = score + 1;
              
          } if(operationFifteen .equals("a")){
              score = score + 1;
              
          } if(operationSixteen .equals("a")){
              score = score + 1;
              
          } if(operationSeventeen .equals("c")){
              score = score + 1;
              
          } if(operationEighteen .equals("a")){
              score = score + 1;
              
          } if(operationNineteen .equals("a")){
              score = score + 1;
              
          } if(operationTwenty .equals("c")){
              score = score + 1;
              
          } if(operationTwentyone .equals("b")){
              score = score + 1;
              
          } if(operationTwentytwo .equals("a")){
              score = score + 1;
              
          } if(operationTwentythree .equals("c")){
              score = score + 1;
              
          } if(operationTwentyfour .equals("c")){
              score = score + 1;
              
          } if(operationTwentyfive .equals("a")){
              score = score + 1;
              
          }
          
          
          
          
          
          
          
          
           if(score == 0){
              IO.display("Sorry " + teamName + ", You got 0%. Please have another go");
              
          }else if(score == 1){
              IO.display("Sorry " + teamName + ", You got 4%. Please have another go");
              
          }else if(score == 2){
              IO.display("Sorry " + teamName + ", You got 8%. Please have another go");
                  
          }else if(score == 3){
              IO.display("Sorry " + teamName + ", You got 12%. Please have another go");
          
          }else if(score == 4){
              IO.display("Sorry " + teamName + ", You got 16%. Please have another go");
                  
          }else if(score == 5){
              IO.display("Sorry " + teamName + ", You got 20%. Please have another go"); 
                  
          }else if(score == 6){
              IO.display("Sorry " + teamName + ", You got 24%. Please have another go");     
                
          }else if(score == 7){
              IO.display("Sorry " + teamName + ", You got 28%. Please have another go");     
                
          }else if(score == 8){
              IO.display("Sorry " + teamName + ", You got 32%. Very close to a pass, have another go");     
                
          }else if(score == 9){
              IO.display("Sorry " + teamName + ", You got 36%. Very close to a pass, have another go");     
                
          }else if(score == 10){
              IO.display("Nice try " + teamName + ", You got 40%. You have just about passed");     
                
          }else if(score == 11){
              IO.display("Nice try " + teamName + ", You got 44%. You have just about passed");     
                
          }else if(score == 12){
              IO.display("Nice try " + teamName + ", You got 48%. You have just about passed");     
                
          }else if(score == 13){
              IO.display("Nice try " + teamName + ", You got 52%. You got a solid score");     
                
          }else if(score == 14){
              IO.display("Nice try " + teamName + ", You got 56%. You got a solid score");     
                
          }else if(score == 15){
              IO.display("Nice try " + teamName + ", You got 60%. You got a solid score");     
                
          }else if(score == 16){
              IO.display("Nice try " + teamName + ", You got 64%. Not a bad effort");     
                
          }else if(score == 17){
              IO.display("Nice try " + teamName + ", You got 68%. Not a bad effort");     
                
          }else if(score == 18){
              IO.display("Nice try " + teamName + ", You got 72%. Not a bad effort");     
                
          }else if(score == 19){
              IO.display("Nice try " + teamName + ", You got 76%. A brilliant effort");     
                
          }else if(score == 20){
              IO.display("Nice try " + teamName + ", You got 80%. A brilliant effort");     
                
          }else if(score == 21){
              IO.display("Nice try " + teamName + ", You got 84%. A brilliant effort");     
                
          }else if(score == 22){
              IO.display("Nice try " + teamName + ", You got 88%. An outstanding effort");     
                
          }else if(score == 23){
              IO.display("Well done " + teamName + ", You're into the 90's with a great score of 92%");     
                
          }else if(score == 24){
              IO.display("Well done " + teamName + ", You're into the 90's with a great score of 96%");
              
          }else if(score == 25){
              IO.display("Well done " + teamName + ", You have scored the maximum of 100%. An amazing score");
             
              
          
     
      
      } //main()
      }//pubQuiz
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: HELP - Java quiz application won't run

    What is the IO class? It's not part of standard Java, so is it a class that your instructor gave you?

  3. #3
    MD1993 is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: HELP - Java quiz application won't run

    yes, but it works fine when i compile/run it on uni PC, but not at home on my laptop!

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,308
    Blog Entries
    7
    Rep Power
    20

    Default Re: HELP - Java quiz application won't run

    Quote Originally Posted by MD1993 View Post
    yes, but it works fine when i compile/run it on uni PC, but not at home on my laptop!
    Then the IO class is reachable (through a classpath setting or even in the ext directory of the installation) on your university PC but it isn't on your home laptop.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    MD1993 is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: HELP - Java quiz application won't run

    ok, its just hard to get to and from uni to mess with it

    thanks for the replies tho :)

Similar Threads

  1. Replies: 4
    Last Post: 01-20-2012, 09:43 AM
  2. Please help with java quiz (should be easy to help)
    By karoloydi in forum New To Java
    Replies: 1
    Last Post: 11-29-2011, 02:59 AM
  3. JAVA Quiz
    By sara1988 in forum New To Java
    Replies: 4
    Last Post: 09-14-2011, 05:20 AM
  4. Swing java quiz
    By htuy in forum New To Java
    Replies: 7
    Last Post: 07-08-2011, 06:02 AM
  5. Help with "Head First Java" quiz
    By TheWhopper in forum New To Java
    Replies: 6
    Last Post: 06-04-2011, 06:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •