Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java programming

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java programming

    Remove the words that begin with two consonants. Need hep with this.


  2. #2
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can't find problem.;/

    Remove the words that begin with two consonants.

    package pi11b_savarankiskas_d;


    import java.util.StringTokenizer;
    public class Pi11b_savarankiskas_d {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    byte bsak[]=new byte[100];
    System.out.println("Įvesti sakinį:");
    try{
    int bytes=System.in.read(bsak);
    }
    catch(Exception e){
    System.out.println(e);
    }
    finally{
    String strsa=new String(bsak);
    fun(strsa);
    }
    }

    public static void fun(String sak) {
    System.out.println("Įvestas sakinys:"+sak);
    String sep=" ,;:?!.";
    String zodis;
    final int N=13;
    String [] strzodmas=new String[N];
    StringTokenizer x=new StringTokenizer(sak,sep);
    int kiek = x.countTokens();
    //int nT=x.countTokens();
    int i=0;
    while(x.hasMoreTokens())
    {
    zodis=x.nextToken();
    strzodmas[i++]=zodis;
    }
    int j;
    char[] c=new char[20];
    c[0] = 'b';
    c[1] = 'c';
    c[2] = 'č';
    c[3] = 'd';
    c[4] = 'f';
    c[5] = 'g';
    c[6] = 'h';
    c[7] = 'j';
    c[8] = 'k';
    c[9] = 'l';
    c[10] = 'm';
    c[11] = 'n';
    c[12] = 'p';
    c[13] = 'r';
    c[14] = 's';
    c[15] = 'š';
    c[16] = 't';
    c[17] = 'v';
    c[18] = 'z';
    c[19] = 'ž';


    for (j=0; j<kiek; j++)
    {
    char pirmas = strzodmas[j].charAt(0);
    char antras = strzodmas[j].charAt(1);

    if((pirmas != c[0]) && (pirmas != c[1]) && (pirmas != c[2]) && (pirmas != c[3]) && (pirmas != c[4]) && (pirmas != c[5]) && (pirmas != c[6]) && (pirmas != c[7]) && (pirmas != c[8]) && (pirmas != c[9]) && (pirmas != c[10]) && (pirmas != c[11]) && (pirmas != c[12]) && (pirmas != c[13]) && (pirmas != c[14]) && (pirmas != c[15]) && (pirmas != c[16]) && (pirmas != c[17]) && (pirmas != c[18]) && (pirmas != c[19]) )
    {
    System.out.println(strzodmas[j]);
    }
    else if ((antras != c[0]) && (antras != c[1]) && (antras != c[2]) && (antras != c[3]) && (antras != c[4]) && (antras != c[5]) && (antras != c[6]) && (antras != c[7]) && (antras != c[8]) && (antras != c[9]) && (antras != c[10]) && (antras != c[11]) && (antras != c[12]) && (antras != c[13]) && (antras != c[14]) && (antras != c[15]) && (antras != c[16]) && (antras != c[17]) && (antras != c[18]) && (antras != c[19]))
    {
    System.out.println(strzodmas[j]);
    }
    }
    }
    }

  3. #3
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Can't find problem.;/

    Please edit your post using code tags

     

    It makes things much easier to read and follow the logical flow of
    your program.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  4. #4
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Java programming

    Hi Welcome to the forum.

    Please do not double post your questions, keep them in the one
    domain.

    Moderator Request:

    Please move or remove this thread.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Java programming

    Threads merged. Thanks, Ada.

Similar Threads

  1. Java Programming (Object Oriented Programming) Assignment
    By azmilPhenom in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2013, 07:26 AM
  2. Polymorphism Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2013, 02:21 PM
  3. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  4. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM
  5. Is java a power full programming language? can java do this?
    By Jhovarie in forum Java Theory & Questions
    Replies: 5
    Last Post: March 2nd, 2011, 02:02 PM

Tags for this Thread