Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Java Video Game Selector Errors

$
0
0
Hi,

I am currently struggling with this code i am working on and was wondering if someone could help me determine what i am doing wrong or where my mistakes are. If you could please help, I would really appreciate it. The project is a video game selector, it selects a video game out of a library for you to play and all you have to do is enter in a number and it will tell you which game to play. There are some criteria that i have mostly fulfilled, so that is why some things may be different or unnecessary. My problem is that when i ask what game system, an error comes up i cannot determine why it keeps giving me these errors, in addition to that i think my variables i am using for my cases are causing errors with the ones i am using in my scanner.

Please reply with any suggestions and any help is appreciated.

I am also using NetBeans 7.2 if that is relevant.

Here is my code:

package finalproject;
import java.util.Scanner; //import scanner
public class FinalProject {
  public static void main(String[] args) {
           
           int PC;
           PC = 1;
           int Xbox360;
           Xbox360 = 2;
           int Wii;
           Wii = 3;           //Declaring variables
           int N64; 
           N64 = 4;
           int NES;
           NES = 5;
           int SEGA;
           SEGA = 6;
           int game;
           
           
        Scanner input = new Scanner(System.in);// searching for input
        FinalProjectClass nameObject = new FinalProjectClass ();//using method from other class
        
        System.out.println("Enter Your Name Here: ");//asking user for name
        String name = input.nextLine();
        
        nameObject.name(name);//displaying the name using method
        
       Scanner GameDevice = new Scanner(System.in);
       System.out.println("What Game System are you playing? ");//asking what game system the user is playing
       System.out.println("Enter the Number corresponding to your system, Use this list to help you: "
               +"PC= 1 "
               +"Xbox360= 2 "
               +"Wii= 3 "
               +"N64= 4 "
               +"NES= 5 "
               +"SEGA= 6 ");
       
       switch (GameSystem){                    // Using switch to allow system to file through the different variables
           case 1: 
                    System.out.println("Enter a number 1-25 here: "); // asking for a number to decide what game to play
                    game = input.nextLine();
                   
                   
                   switch(game){ // selects game based on number entered and tells the user the name of the game.
                       case 1:
                           System.out.println(" You should Play the Game: Minecraft ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: League Of Legends ");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: The Sims 3 ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: CrossFire ");
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: Left 4 Dead 2 ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: Borderlands 2 ");
                           break;
                       case 7:
                           System.out.println(" You should Play the Game: Empire Total War ");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: EverLong ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: Starcraft II ");
                           break;
                       case 11:
                           System.out.println(" You should Play the Game: Call of Duty: Modern Warfare 2 ");
                           break;
                       case 12:
                           System.out.println(" You should Play the Game: Call of Duty Modern Warfare ");
                           break;
                       case 13:
                           System.out.println(" You should Play the Game: Call of Duty Black Ops 2 ");
                           break;
                       case 14:
                           System.out.println(" You should Play the Game: Guild Wars 2 ");
                           break;
                       case 15:
                           System.out.println(" You should Play the Game: Prototype ");
                           break;
                       case 16:
                           System.out.println(" You should Play the Game: Need For Speed: Most Wanted ");
                           break;
                       case 17:
                           System.out.println(" You should Play the Game: Skyrim ");
                           break;
                       case 18:
                           System.out.println(" You should Play the Game: MoonBase Alpha ");
                           break;
                       case 19:
                           System.out.println(" You should Play the Game: World Of Tanks ");
                           break;
                       case 20:
                           System.out.println(" You should Play the Game: Sim City 3000 ");
                           break;
                       case 21:
                           System.out.println(" You should Play the Game: Bloodline Champions ");
                           break;
                       case 22:
                           System.out.println(" You should Play the Game: Zoo Tycoon ");
                           break;
                       case 23: 
                           System.out.println(" You should Play the Game: Spelunky ");
                           break;
                       case 24:
                           System.out.println(" You should Play the Game: Assasins Creed ");
                           break;
                       case 25:
                           System.out.println(" You should Play the Game: World Of Warcraft ");
                           break;}
              break;
        case 2: 
                    
                    System.out.println("Enter a number 1-21 here: ");
                    game2 = input.nextLine();
                   
                   
                   switch(game2){
                       case 1:
                           System.out.println(" You should Play the Game: Mass Effect ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: Call of Duty 2 ");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: RockBand ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: Need for Speed: Hot Pursuit ");
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: Kameo ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: Ghost Recon");
                           break;
                       case 7:
                           System.out.println(" You should Play the Game: Crackdown ");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: Crackdown 2 ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: Oblivion");
                           break;
                       case 11:
                           System.out.println(" You should Play the Game: Call of Duty: Modern Warfare 2 ");
                           break;
                       case 12:
                           System.out.println(" You should Play the Game: Call of Duty Modern Warfare ");
                           break;
                       case 13:
                           System.out.println(" You should Play the Game: Call of Duty Black Ops 2 ");
                           break;
                       case 14:
                           System.out.println(" You should Play the Game: Halo 3 ");
                           break;
                       case 15:
                           System.out.println(" You should Play the Game: Gears of War ");
                           break;
                       case 16:
                           System.out.println(" You should Play the Game: Need For Speed: Most Wanted ");
                           break;
                       case 17:
                           System.out.println(" You should Play the Game: Skyrim ");
                           break;
                       case 18:
                           System.out.println(" You should Play the Game: Madden NFL '10 ");
                           break;
                       case 19:
                           System.out.println(" You should Play the Game: NCAA Football '08");
                           break;
                       case 20:
                           System.out.println(" You should Play the Game: NBA Live '08 ");
                           break;
                       case 21:
                           System.out.println(" You should Play the Game: BattleField 3 ");
                           break;
                       
                 break;}
        case 3:
                    System.out.println("Enter a number 1-19 here: ");
                    game3 = input.nextLine();
                   
                   
                   switch(game3){
                       case 1:
                           System.out.println(" You should Play the Game: Carnival Games ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: Super Smash Bros. Brawl ");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: Super Swing Golf ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: Super Mario Galaxy ");
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: Super Mario Galaxy 2  ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: MarioKart Wii");
                           break;
                       case 7:
                           System.out.println(" You should Play the Game: Family Game Night ");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: Animal Crossing: City Folk ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: Mario and Sonic at the Olympic Games");
                           break;
                       case 11:
                           System.out.println(" You should Play the Game: Mario and Sonic at the Olympic Winter Games ");
                           break;
                       case 12:
                           System.out.println(" You should Play the Game: NBA Live '09 All-Play ");
                           break;
                       case 13:
                           System.out.println(" You should Play the Game: WiiPlay ");
                           break;
                       case 14:
                           System.out.println(" You should Play the Game: WiiSports");
                           break;
                       case 15:
                           System.out.println(" You should Play the Game: The Legend of Zelda: Twilight Princess ");
                           break;
                       case 16:
                           System.out.println(" You should Play the Game: The Legend of Zelda: Skyward Sword ");
                           break;
                       case 17:
                           System.out.println(" You should Play the Game: Super Mario Bros. Wii ");
                           break;
                       case 18:
                           System.out.println(" You should Play the Game: Donkey Kong Country Returns");
                           break;
                       case 19:
                           System.out.println(" You should Play the Game: Links Crossbow Training");
                           break;
                break;}
      
        case 4: 
                    
                   System.out.println("Enter a number 1-32 here: ");
                    game4 = input.nextLine();
                   
                   
                   switch(game4){
                       case 1:
                           System.out.println(" You should Play the Game: Harvest Moon 64 ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: Super Smash Bros.");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: Mario Party 2 ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: Quest 64")              "
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: GoldenEye 007  ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: Mariokart 64" );
                           break;
                       case 7:
                           System.out.println(" You should Play the Game: Tonic Trouble ");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: The Legend of Zelda: Ocarina Of Time ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: The Legend of Zelda: Majora's Mask ");
                           break;
                       case 11:
                           System.out.println(" You should Play the Game: Mario Tennis ");
                           break;
                       case 12:
                           System.out.println(" You should Play the Game: Goemons Great Adventure ");
                           break;
                       case 13:
                           System.out.println(" You should Play the Game: Rugrats Scavenger Hunt ");
                           break;
                       case 14:
                           System.out.println(" You should Play the Game: Rainbox Six );
                           break;
                       case 15:
                           System.out.println(" You should Play the Game: Tony Hawks Pro Skater ");
                           break;
                       case 16:
                           System.out.println(" You should Play the Game: Pokemon Stadium ");
                           break;
                       case 17:
                           System.out.println(" You should Play the Game: Pokemon Stadium 2 ");
                           break;
                       case 18:
                           System.out.println(" You should Play the Game: Diddy Kong Racing");
                           break;
                       case 19:
                           System.out.println(" You should Play the Game: A Bugs Life ");
                           break;
                       case 20:
                           System.out.println(" You should Play the Game: Mega Man 64 );
                           break;
                       case 21:
                           System.out.println(" You should Play the Game: Yoshi's Story");
                           break;
                       case 22:
                           System.out.println(" You should Play the Game: Glover ");
                           break;
                       case 23:
                           System.out.println(" You should Play the Game: Ready 2 Rumble Boxing ");
                           break;
                       case 24:
                           System.out.println(" You should Play the Game: Wipeout 64");
                           break;
                       case 25:
                           System.out.println(" You should Play the Game: Extreme XG2 ");
                           break;
                       case 27:
                           System.out.println(" You should Play the Game: Banjo-Kazooie );
                           break;
                       case 28:
                           System.out.println(" You should Play the Game: Super Mario 64");
                           break;
                       case 29:
                           System.out.println(" You should Play the Game: Starfox 64 ");
                           break;
                       case 30:
                           System.out.println(" You should Play the Game: Kirby 64 The Crystal Shards ");
                           break;
                       case 31:
                           System.out.println(" You should Play the Game: Pokemon Puzzle League 64");
                           break;
                       case 32:
                           System.out.println(" You should Play the Game: Dr. Mario 64 ");
                           break;
                 break;}
        case 5:
            
                    System.out.println("Enter a number 1-10 here: ");
                    game5 = input.nextLine();
                   
                   
                   switch(game5){
                       case 1:
                           System.out.println(" You should Play the Game: Troy Aikman Football ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: Sonic The Hedgehog ");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: College Slam ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: Double Dribble ");
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: Techmo Super Hockey ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: Batman Forever ");
                           break;
                       case 7:
                           System.out.println(" You should Play the Game: Spider-Man ");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: Triple Play ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: Zoop ");
                           break;
                       
                       break;}
           
        case 6:

                    System.out.println("Enter a number 1-10 here: ");
                    game6 = input.nextLine();
                   
                   
                   switch(game6){
                       case 1:
                           System.out.println(" You should Play the Game: StarTropics ");
                           break;
                       case 2:
                           System.out.println(" You should Play the Game: ExciteBike ");
                           break;
                       case 3:
                           System.out.println(" You should Play the Game: Prince of Persia ");
                           break;
                       case 4:
                           System.out.println(" You should Play the Game: Super Mario Bros. 2" );
                           break;
                       case 5:
                           System.out.println(" You should Play the Game: Golf ");
                           break;
                       case 6:
                           System.out.println(" You should Play the Game: Jordan v.s Bird oneon one ");
                           break;
                       case 7:
                           System.out.println(" You should Play the Game:  Super Mario Bros./ Duck Hunt");
                           break;
                       case 9: 
                           System.out.println(" You should Play the Game: Rad Racer ");
                           break;
                       case 10: 
                           System.out.println(" You should Play the Game: Teenage Mutant Ninja Turtles II: The Arcade Game ");
                           break;
             break;}
                
       }}}


This is tha class that i am using the method in

package finalproject;
class FinalProjectClass {
    public void name(String name){
        System.out.println("Hello"+  name);
}
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>