Results 1 to 2 of 2
  1. #1
    mrprogrammer is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default I dunno what to do next :'(

    Hey guys, i'm making a typing game and i am begging all of you to help me. I have some problems making the next word appear after you get the first one. And can also help me guys on how to put a 2 minute timer? Here's the code:

    Java Code:
    import java.util.Random;
    import java.util.Scanner;
    
    public class Easy {
        
        public static void main (String []args){
            
            String words[]={"Love", "Hate", "Truth", "Happy", "Pressure", "Burp", "Vampire"
            , "Surf", "Believe", "Slime", "Dream", "Religion", "Rhythm", "Disco", "Honey",
            "Star", "Armies", "Zombie", "Heart", "Break", "Docks", "Multiply", "Mace", "Moustache"
            , "Wizards", "Sports", "Blind", "Riddle", "Business", "School", "Blood", "Promenade",
            "Vault", "Spray", "Eternal", "Dress", "Abstain", "Controls", "Circuit", "Forever",
            "Dangerous", "Skunk", "House", "Wives", "Flashlight", "Console", "Awesome", "Scared",
            "Hormones", "Promise", "Angel", "Baggage", "Duck", "Destroy", "Tissue", "Ketchup",
            "Picture", "Basket", "Basketball", "Fan", "Dough", "Thief", "Female", "Family", "Normal",
            "Wireless", "Empty", "Cycles", "Banana", "Eggplant", "Samba", "Jumble", "Flush", "Beach",
            "Driver", "Queen", "Mommy", "Fade", "Kitten", "Spring", "Interest", "Debts", "Horse",
            "Tomorrow", "Discount", "Faithful", "Midnight", "Epic", "Calendar", "Roses", "Funeral",
            "Badminton", "Spirit", "Water", "Pizza", "Science", "Cabinet", "Apple", "Television",
            "Profile", "Wine", "Sedan", "Luxury", "Firewall", "Computer", "Tablet", "Giraffe", "Ring",
            "Shut", "Vision", "World", "War", "High", "School", "Fantasy", "Warfare", "Incognito",
            "Loading", "Penguins", "Fright", "Night", "Diary", "Mega", "Submit", "Hold", "Statue",
            "Boat", "Mobile", "Invisible", "Visible", "Ground", "Space", "Dragon", "Spade", "Clover",
            "Senior", "Junior", "Sophomore", "Freshman", "Twilight", "Dawn", "Eclipse", "Moon",
            "Hair", "Spray", "Camp", "Jazz", "Rock", "Eggs", "Hustle"};
            
           Scanner sc = new Scanner(System.in); 
           Random a = new Random();
           int roll = a.nextInt(149);
           String type = "";
           String reply = "yes";
           int error = 0;
           
           System.out.println(words[roll]);
        
        while (!reply.equalsIgnoreCase("no")){
        	if (!reply.equalsIgnoreCase("yes"))
        		System.out.println("Yes and No are the only acceptable answers");
        	
        	else {
        		System.out.println("Type the word");
        		
        		
        		
        		
        		while (!type.equals(words[roll])){
        			type = sc.next();
        			try {
        				if (!type.equals(words[roll])){
        					System.out.println("Type again");
        					error++;
        					}
        				else {
        					if (!type.equals(words[roll]))
        					System.out.println("next word");
        					      
        				}
        					
        			}catch(Exception e){
        				
        				System.out.println("lallalala");
        			}
        			
        		}
        	}
        	type = "";
    		System.out.println("Would you like to play again? Yes/No");
    		reply = sc.nextLine();
    		roll = a.nextInt(149);
    		
    		
    		
        }
        System.out.println("Thank you for playing");
        }
    }
    ADVANCED THANK YOU GUYS FOR HELPING ME!!!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    10,094
    Rep Power
    17

    Default Re: I dunno what to do next :'(

    Quote Originally Posted by mrprogrammer View Post
    I dunno what to do next :'(
    Try reading the Forum Rules -- particularly the second and third paragraphs.

    db

    THREAD CLOSED
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. repaint class doesnt work anymore... dunno why..
    By Addez in forum New To Java
    Replies: 9
    Last Post: 11-07-2009, 09:10 PM

Posting Permissions

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