greetings, fellow internet!

welcome to digitalgangster.com, the coolest community for people who hack the gibson and make bajillions of dollars off of online marketing. please click here to register an account (it's free) and join in on a plethora of discussions with the internet elite.

ASGPHE,
ytcracker, original digital gangster
follow me on twitter
fan me on facebook
Results 1 to 26 of 26

Thread: Please

  1. #1
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Exclamation Please

    Hey, guys... I really need your help with this...for some reason, my while loops are getting jumbled in my head and I can't see this straight. This is
    java.

    Problem:

    The statistician for a professional baseball team collects batting data for each hitter on the team in a separate file. Each file resembles the following example from early in the season:


    # AB BB B1 B2 B3 B4 HP SC
    1 4 0 0 2 0 0 0 0
    2 3 0 0 1 0 0 0 1
    3 6 0 2 1 0 0 1 0
    4 3 0 1 0 0 0 0 0
    5 5 0 2 0 0 0 0 0
    -1


    #--Game Number
    AB--At Bats
    BB--Bases on balls (walks)
    B1--Singles
    B2--Doubles
    B3--Triples
    B4--Home runs
    HP--Hit by pitch
    SC--Sacrifices


    The sentinel value of -1 at the beginning of the line marks the end of the data.

    The statistisian desires a computer program that will prompt the user for the name of a file and then read the specified file and calculate a batting average (BA), a slugging percentage (SP), and an on-base percentage (OBP), as follows:

    BA=(B1+B2+B3+B4)/AB
    SP=(B1+B2*2+B3*3+B4*4)/AB
    OBP= (B1+B2+B3+B4+BB+HP)/(AB+BB+HP+SC)

    Output data must be formatted exactly as shown:

    Batting Statistics
    --------------------------
    Games Played : 999
    Batting Average : 9.999
    Slugging Percentage: 9.999
    On-base Percentage : 9.999

    Crazy amounts of love to anyone willing
    to help me.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  2. #2
    FUCKINMETAL's Avatar
    Join Date
    Jun 2005
    Location
    lollertown
    Posts
    13,468

    Default

    the awnser is elventy twelve to the nth power of 19 cubed
    Quote Originally Posted by delirium View Post
    Get a 40, some kush, and hit up some internet porn I guarantee you will feel better in the morning

  3. #3
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    Quote Originally Posted by FUCKINMETAL View Post
    the awnser is elventy twelve to the nth power of 19 cubed
    lolz. i wish it was that simple.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  4. #4
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    import java.util.Scanner;
    import javax.swing.JOptionPane;
    import java.io.File;
    import java.io.IOException;

    public class BattingStatistics
    {

    public static void main (String [] args)throws IOException
    {

    final int SENTINEL = -1;
    int AB, BB, B1, B2, B3, B4, HP, SC;
    double BA, SP, OBP;

    String stats = JOptionPane.showInputDialog( null, "Please enter the file name.");

    File statsFile = new File(stats);
    Scanner scan = new Scanner(statsFile);

    scan.nextLine();

    }
    }


    //this is what I have so far.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  5. #5
    FUCKINMETAL's Avatar
    Join Date
    Jun 2005
    Location
    lollertown
    Posts
    13,468

    Default

    Code:
    While I don't know shit about coding, you should wrap your code in code tags when posting it on the board...
    Quote Originally Posted by delirium View Post
    Get a 40, some kush, and hit up some internet porn I guarantee you will feel better in the morning

  6. #6
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    whatever. it's not that hard to get the picture. :P
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  7. #7
    PiMpY's Avatar
    Join Date
    Feb 2005
    Location
    Still in the hood...
    Posts
    25,294

    Default


  8. #8
    KRS OWNS MY FAGGOT ASS hu5tlr hunter's Avatar
    Join Date
    Jul 2005
    Location
    The Couve, WA
    Posts
    6,938

    Default

    Quote Originally Posted by PiMpY View Post
    ROFLMAO WOW MAN SO NASTY

  9. #9
    I am Fredryck Fox! Vershun's Avatar
    Join Date
    May 2005
    Location
    Denver, CO
    Posts
    16,124

    Default

    Quote Originally Posted by DryasFatalis View Post
    Code:
    import java.util.Scanner;
    import javax.swing.JOptionPane;
    import java.io.File;
    import java.io.IOException;
    
    public class BattingStatistics
    {
    
        public static void main (String [] args)throws IOException 
        {
    
          final int SENTINEL = -1;
          int AB, BB, B1, B2, B3, B4, HP, SC;
          double BA, SP, OBP; 
          
          String stats = JOptionPane.showInputDialog( null, "Please enter the file name.");
          
          File statsFile = new File(stats);
          Scanner scan = new Scanner(statsFile);
    
          scan.nextLine();
             
        }
    }
    
    
    //this is what I have so far.
    My Java is extremely rusty and we didn't have this fancy Scanner class when I was a little whipper-snapper but just from a really quick glace at the docs try something like this:

    Code:
    import java.util.Scanner;
    import javax.swing.JOptionPane;
    import java.io.File;
    import java.io.IOException;
    
    public class BattingStatistics
    {
    
        public static void main (String [] args)throws IOException 
        {
    
          final int SENTINEL = -1;
          int AB, BB, B1, B2, B3, B4, HP, SC, abOrSent;
          double BA, SP, OBP; 
    
          AB = BB = B1 = B2 = B3 = B4 = HP = SC = BA = SP = OBP = 0;
          
          String stats = JOptionPane.showInputDialog( null, "Please enter the file name.");
          
          File statsFile = new File(stats);
          Scanner scan = new Scanner(statsFile);
    
          while( (abOrSent = scan.nextInt()) != SENTINEL)
          {
                 AB += abOrSent;
                 BB += scan.nextInt();
                 B1 += scan.nextInt();
                 ....do this till you get to the end
           }
           //Do your overall calcs here
           //Display here
        }
    }

  10. #10

    Default

    i was about to ask where versh was at but god answered

  11. #11
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    I love you, versh!
    You are a lifesaver.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  12. #12
    dRaven's Avatar
    Join Date
    May 2005
    Location
    Mars
    Posts
    5,661

    Default

    ha..now everyone in his class is going to think he is smart.

  13. #13
    I am Fredryck Fox! Vershun's Avatar
    Join Date
    May 2005
    Location
    Denver, CO
    Posts
    16,124

    Default

    Quote Originally Posted by DryasFatalis View Post
    I love you, versh!
    You are a lifesaver.
    ilumore.

    dRaven 90% sure she's of the vaginal persuasion.

  14. #14

    Default

    Quote Originally Posted by Vershun View Post
    ilumore.

    dRaven 90% sure she's of the vaginal persuasion.
    error you just referenced a variable before you assigned it a value
    Last edited by budlight; 10-24-2006 at 09:35 PM.

  15. #15
    themaSk's Avatar
    Join Date
    Feb 2005
    Location
    mcdonalds
    Posts
    6,901

    Default

    i'm taking java this whole year


    and i hate it
    HAMBURGLA. =)
    aka yer neighborhood hamburger stealer




    Quote Originally Posted by dag
    $dag: "get one of that kid sucking my cock! want some baby!!! i hate u bro, ill fucking kill you! ill fckng kill you!!!! u wanna smerk at me son?!!? ill knock your ass out!!" - bill 2k8
    /greatestquote

  16. #16
    lol wen dazed's Avatar
    Join Date
    Jul 2005
    Location
    Puerto Rico
    Posts
    6,800

    Default

    yeah I've done this, what I did was copy Wang's program and change the vars to make it look like I wrote it. A+ btw

  17. #17
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    Quote Originally Posted by Vershun View Post
    ilumore.

    dRaven 90% sure she's of the vaginal persuasion.
    I'm 100% sure.


    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  18. #18
    I am not akira rj45's Avatar
    Join Date
    Jul 2005
    Posts
    3,206

    Default

    hai dryas
    ytcracker said hi to me once...
    Quote Originally Posted by ytcracker View Post
    hi

  19. #19
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    hai, rj. How are you doing?
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  20. #20
    I am not akira rj45's Avatar
    Join Date
    Jul 2005
    Posts
    3,206

    Default

    meh i'm livin
    hows youse babes?
    ytcracker said hi to me once...
    Quote Originally Posted by ytcracker View Post
    hi

  21. #21
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    I'm doing alright. Doing that college thing. Still amazed, as long as I've been here, that people still think I'm a guy. lolz.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  22. #22
    I am not akira rj45's Avatar
    Join Date
    Jul 2005
    Posts
    3,206

    Default

    you should repost the bra pic
    it will convince some and make for nifty JO material for others
    ytcracker said hi to me once...
    Quote Originally Posted by ytcracker View Post
    hi

  23. #23
    wtfx DryasFatalis's Avatar
    Join Date
    Sep 2005
    Location
    Mississippi
    Posts
    1,190

    Default

    lolz. that pic was up for like 5 minutes WAYYY back in 0d5 I don't even know if i have it anymore, and probably wouldn't repost it even if I did.
    <Schlzm> zombies are for shooting not sexing

    <silentj> kayla has been twitching like wtf
    <silentj> ZOMBIE PEEPS BRAINS KNEES ACID MICROWAVE *TWITCH TWITCH* SKITTLES

    <silentj> yeah jehova, taste the rainbrains

    <silentj> i"m kayla and I'm logical, I like to microwave peeps while im on acid so that they become zombies.

    <Kayla> logic is illogical.
    <Kayla> wtf did i just say?

  24. #24
    I am not akira rj45's Avatar
    Join Date
    Jul 2005
    Posts
    3,206

    Default

    lest we forget
    lucky i still don't have that or else i'd be posting it with the quickness simply for giggles sakes
    ytcracker said hi to me once...
    Quote Originally Posted by ytcracker View Post
    hi

  25. #25
    Zain's Avatar
    Join Date
    May 2005
    Location
    metropolitan detroit
    Posts
    24,253

    Default

    i think what this code translates to is
    go tigers

  26. #26
    SoHov's Avatar
    Join Date
    Mar 2006
    Location
    no
    Posts
    11,514

    Default

    lol ¯\(°_o)/¯

    Quote Originally Posted by pad View Post
    [DG] is an unorganized free for all packed to the brim with unfunny inside jokes and the most retarded nonsense imaginable


Bookmarks

Posting Permissions

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