I need halp with extra credit--I have a bad grade in my CS class.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrHuggykins
    New Member
    • Mar 2008
    • 27

    I need halp with extra credit--I have a bad grade in my CS class.

    The task is: Read integer values from the keyboard until the value 99 is entered. Display an error message if it is not equal to 99. When 99 is entered your program should do the following: Display a count of how many times the values 0-10 were entered. For example the display would look like: "you entered 0 this many times, 1 this many times, 2 this many times" etc. exit the program.

    I know you need to use if statements but I'm still fuzzy about them and switch statements I don't know how to use. (Of course that's why it's extra credit. lol) Thanks for any halp.
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Why not review if statements and switch statements:

    Comment

    • MrHuggykins
      New Member
      • Mar 2008
      • 27

      #3
      Originally posted by BigDaddyLH
      Why not review if statements and switch statements:

      http://java.sun.com/docs/books/tutor...olts/flow.html
      Thank you! I'll read this right now.

      Comment

      • MrHuggykins
        New Member
        • Mar 2008
        • 27

        #4
        Originally posted by MrHuggykins
        Thank you! I'll read this right now.
        [code=java]Excuse the language but I was frustrated lol
        public class fag {
        public static void main(String[] args)
        {
        int[] shitface=new int[11];
        int input=0;
        while (input!=99)
        {
        input=Console.r eadInt("Enter some shit");
        shitface[input]+=1;
        }
        for (int x=0;x<shitface. length;x++)
        {
        System.out.prin tln("You entered "+x+" "+shitface[x]+" times. Kiss my ass.");
        }
        }
        }
        [/code]

        Comment

        • BigDaddyLH
          Recognized Expert Top Contributor
          • Dec 2007
          • 1216

          #5
          Originally posted by MrHuggykins
          [code=java]Excuse the language but I was frustrated lol
          public class fag {
          public static void main(String[] args)
          {
          int[] shitface=new int[11];
          int input=0;
          while (input!=99)
          {
          input=Console.r eadInt("Enter some shit");
          shitface[input]+=1;
          }
          for (int x=0;x<shitface. length;x++)
          {
          System.out.prin tln("You entered "+x+" "+shitface[x]+" times. Kiss my ass.");
          }
          }
          }
          [/code]
          Apart from the problem with potty mouth, do you have a question?

          Comment

          • sukatoa
            Contributor
            • Nov 2007
            • 539

            #6
            Originally posted by BigDaddyLH
            Apart from the problem with potty mouth, do you have a question?
            also inclose your codes with a codetag

            eg. [/CODE] at the end and [CODE=JAVA] at the top of your code...

            Concerned citizen,
            sukatoa

            Comment

            Working...