Results 1 to 12 of 12

Thread: Write a Java program for money/reps

  1. #1
    roflcopter V-Spec II
    Join Date
    Dec 2005
    Location
    Norcross
    Age
    37
    Posts
    7,386
    Rep Power
    33

    Default Write a Java program for money/reps

    Alright I need a simple java program (Intro to Java) written ASAP. Paypal and reps are in order.

    Question:

    "Find the calss StringBuffer in java API, and find appropriate methods in the class to do the following:

    Finding all matches of a substring in a given string, the substring and the string must be inputted from the keyboard.

    The output should be the starting index numbers of the matches. For example, if the substring is "ab" and the string is "xabbnabz" then the output is 1 and 5, the indices of the two matches from left."

    I KNOW we have some java monsters in our midsts.

  2. #2
    Im blunt,Get over it blacknightteg's Avatar
    Join Date
    Mar 2005
    Location
    Gwinnett-Grayson
    Age
    39
    Posts
    11,868
    Rep Power
    36

    Default

    fuuuuuuuuuuck that.
    Canon Nutswinger:
    Canon XS
    18-55mm
    55-250mm
    50mm USM

  3. #3
    roflcopter V-Spec II
    Join Date
    Dec 2005
    Location
    Norcross
    Age
    37
    Posts
    7,386
    Rep Power
    33

    Default

    Quote Originally Posted by blacknightteg
    fuuuuuuuuuuck that.
    x2. It'd be easy for someone who knows the ins and outs though.

  4. #4
    Im blunt,Get over it blacknightteg's Avatar
    Join Date
    Mar 2005
    Location
    Gwinnett-Grayson
    Age
    39
    Posts
    11,868
    Rep Power
    36

    Default

    true lol.
    Canon Nutswinger:
    Canon XS
    18-55mm
    55-250mm
    50mm USM

  5. #5
    Douchebag Ed's Avatar
    Join Date
    Aug 2005
    Location
    Smyrna, GA
    Age
    40
    Posts
    13,310
    Rep Power
    42

    Default

    man 3 years ago when i was taking java hardcore i could do it but i forgot it all. if you cant get it done by tonight i'll give it a try.

  6. #6
    roflcopter V-Spec II
    Join Date
    Dec 2005
    Location
    Norcross
    Age
    37
    Posts
    7,386
    Rep Power
    33

    Default

    Quote Originally Posted by Ed
    man 3 years ago when i was taking java hardcore i could do it but i forgot it all. if you cant get it done by tonight i'll give it a try.
    Need it by 1:45 lolz...

  7. #7
    Douchebag Ed's Avatar
    Join Date
    Aug 2005
    Location
    Smyrna, GA
    Age
    40
    Posts
    13,310
    Rep Power
    42

    Default

    ah. good luck.

  8. #8
    1010011010 Atlblkz06's Avatar
    Join Date
    Aug 2008
    Location
    Hell
    Age
    37
    Posts
    2,192
    Rep Power
    21

    Default

    I forgot java but... can you input the string as an array, loop through blocks of letters to find the query?

    say the input block is "bobwehadababyitsaboy" (length 20)
    You are searching for "had".
    had = 3 length.

    make the program loop through the array from 1 to 20-3.
    Select 3 letters and see if those 3 match "had".
    Record the positions where you get a match and your output will be "5"

    Hope that helps.

  9. #9
    Senior Member | IA Veteran man's Avatar
    Join Date
    Mar 2005
    Age
    39
    Posts
    6,690
    Rep Power
    29

    Default

    if you woulda posted up earlier it would be no problem. I'll see what I can do
    IA Rules doesn't allow these images in sigs

    - IA Mgmt

  10. #10
    1010011010 Atlblkz06's Avatar
    Join Date
    Aug 2008
    Location
    Hell
    Age
    37
    Posts
    2,192
    Rep Power
    21

    Default

    Is it done yet fcman? Tick tock! lol

  11. #11
    roflcopter V-Spec II
    Join Date
    Dec 2005
    Location
    Norcross
    Age
    37
    Posts
    7,386
    Rep Power
    33

    Default

    Got it gentlemen, thanks anyway. If any of you were working on it, here's one of the things it could look like:

    import javax.swing.JOptionPane;

    public class nurvspecii {
    public static void main(String args[]) {
    String subString = JOptionPane.showInputDialog(null, "Sub String: ");
    String mainString = JOptionPane.showInputDialog(null, "Main String: ");

    StringBuffer x = new StringBuffer(mainString);

    for(int i=0; i<=mainString.length()-subString.length(); i++) {

    String temp = x.substring(i,(i+subString.length()));
    if (temp.equals(subString)) {
    JOptionPane.showMessageDialog(null, i);
    }
    }
    }
    }
    Last edited by MongolPup; 04-23-2009 at 02:04 PM.

  12. #12
    Ghost AirMax95's Avatar
    Join Date
    Jun 2005
    Location
    On a Plane
    Posts
    4,431
    Rep Power
    27

    Default

    Fuuuckkkkkk Java......although I am relearning it, lol.

    VB anyone? lol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
ImportAtlanta is a community of gearheads and car enthusiasts. It does not matter what kind of car or bike you drive, IA is an open community for any gearhead. Whether you're looking for advice on a performance build or posting your wheels for sale, you're welcome here!
Announcement
Welcome back to ImportAtlanta. We are currently undergoing many changes, so please report any issues you encounter with the site using the 'Contact Us' button below. Thank you!