Results 1 to 4 of 4
  1. #1
    riches is offline Member
    Join Date
    Feb 2013
    Location
    Dublin,Ireland
    Posts
    1
    Rep Power
    0

    Default Array checking and element swapping Help Needed?

    Hi guys im stuck here I need to write a program that has user enter a sentence then takes the sentence and puts it into an array then split the sentence up into
    elements then after that write a new secret language so for all the vowels use numbers so a=1, e=2, i=3, o=4, u=5 so if the word is apple it turns into 1ppl2 im stuck
    on how to get the word at the index and check the letters then print the numbers instead any help would be great heres what i have so far.

    Java Code:
    import java.util.*;
    
     class SpecialLang{
      public static void main(String[]args){
      StringBuilder str = new StringBuilder();
    
      String S1;
      String [] temp;
    
    
       System.out.println("Please enter a sentence");
       Scanner scan = new Scanner(System.in);
       S1 = scan.nextLine();
    
       temp = S1.split(" ");
    
    	System.out.println("Array :"+temp.length);
        for(int i=0;i<temp.length;i++){
         System.out.println("Index"+i+" :"+temp[i]);
        }
         StringTokenizer token = new StringTokenizer(S1,"a");
         while (token.hasMoreTokens()){
         String myToken = token.nextToken();
          System.out.print(myToken);
    	 }
    	 System.out.println();
    	 for(int i=0;i<temp.length;i++){
    
       }
      }
    }
    Last edited by riches; 03-11-2013 at 12:30 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,455
    Rep Power
    20

    Default Re: Array checking and element swapping Help Needed?

    Moved from Forum Guides.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Array checking and element swapping Help Needed?

    Meh, link was gobbled.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Array checking and element swapping Help Needed?

    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Very new, and very lost
    By NoSwing in forum AWT / Swing
    Replies: 1
    Last Post: 03-09-2011, 04:14 AM
  2. Ok i am lost
    By jaisan72980 in forum New To Java
    Replies: 3
    Last Post: 01-17-2011, 05:20 AM
  3. Lost with subclasses
    By vinyacam in forum New To Java
    Replies: 3
    Last Post: 05-09-2010, 08:12 PM
  4. I'm lost :(
    By leonardjr in forum New To Java
    Replies: 8
    Last Post: 03-03-2009, 05:18 AM
  5. So Lost
    By kandt in forum New To Java
    Replies: 5
    Last Post: 12-13-2008, 10:55 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
  •