Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

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

Question posted by: MrHuggykins (Newbie) on May 14th, 2008 06:25 PM
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.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
BigDaddyLH's Avatar
BigDaddyLH
Moderator
1,147 Posts
May 14th, 2008
06:28 PM
#2

Re: I need halp with extra credit--I have a bad grade in my CS class.
Why not review if statements and switch statements:

http://java.sun.com/docs/books/tuto...bolts/flow.html

Reply
MrHuggykins's Avatar
MrHuggykins
Newbie
20 Posts
May 14th, 2008
06:43 PM
#3

Re: I need halp with extra credit--I have a bad grade in my CS class.
Quote:
Originally Posted by BigDaddyLH
Why not review if statements and switch statements:

http://java.sun.com/docs/books/tuto...bolts/flow.html


Thank you! I'll read this right now.

Reply
MrHuggykins's Avatar
MrHuggykins
Newbie
20 Posts
May 14th, 2008
08:15 PM
#4

Re: I need halp with extra credit--I have a bad grade in my CS class.
Quote:
Originally Posted by MrHuggykins
Thank you! I'll read this right now.


Code: ( text )
  1. Excuse the language but I was frustrated lol
  2. public class fag {
  3. public static void main(String[] args)
  4. {
  5. int[] shitface=new int[11];
  6. int input=0;
  7. while (input!=99)
  8. {
  9. input=Console.readInt("Enter some shit");
  10. shitface[input]+=1;
  11. }
  12. for (int x=0;x<shitface.length;x++)
  13. {
  14. System.out.println("You entered "+x+" "+shitface[x]+" times. Kiss my ass.");
  15. }
  16. }
  17. }

Reply
BigDaddyLH's Avatar
BigDaddyLH
Moderator
1,147 Posts
May 14th, 2008
08:24 PM
#5

Re: I need halp with extra credit--I have a bad grade in my CS class.
Quote:
Originally Posted by MrHuggykins
Code: ( text )
  1. Excuse the language but I was frustrated lol
  2. public class fag {
  3. public static void main(String[] args)
  4. {
  5. int[] shitface=new int[11];
  6. int input=0;
  7. while (input!=99)
  8. {
  9. input=Console.readInt("Enter some shit");
  10. shitface[input]+=1;
  11. }
  12. for (int x=0;x<shitface.length;x++)
  13. {
  14. System.out.println("You entered "+x+" "+shitface[x]+" times. Kiss my ass.");
  15. }
  16. }
  17. }

Apart from the problem with potty mouth, do you have a question?

Reply
sukatoa's Avatar
sukatoa
Needs Regular Fix
411 Posts
May 15th, 2008
12:49 AM
#6

Re: I need halp with extra credit--I have a bad grade in my CS class.
Quote:
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

Reply
Reply
Not the answer you were looking for? Post your question . . .
170,099 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Java Forum Contributors