473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.
May 14 '08 #1
5 1131
BigDaddyLH
1,216 Expert 1GB
Why not review if statements and switch statements:

http://java.sun.com/docs/books/tutor...olts/flow.html
May 14 '08 #2
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.
May 14 '08 #3
Thank you! I'll read this right now.
Expand|Select|Wrap|Line Numbers
  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. }
  18.  
May 14 '08 #4
BigDaddyLH
1,216 Expert 1GB
Expand|Select|Wrap|Line Numbers
  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. }
  18.  
Apart from the problem with potty mouth, do you have a question?
May 14 '08 #5
sukatoa
539 512MB
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
May 15 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: SteveM | last post by:
This is probably an easy answer but since I am fairly new to C++ for some reason I can't see it :-( Any help would be appreciated :-) I have a class: class AClass { public:
2
by: Aaron | last post by:
If my BIL is inheriting and makes reference to my base class why do I also need to make reference to my base class in my UI? I thought the BIL could encapulate away this level of detail from the...
8
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
1
by: sparkid | last post by:
I need immediate help in writing a function program. I have to write a program in functions and use array to store them. I am not familiar with functions and i tried to create it but i fails to...
1
by: SpreadTooThin | last post by:
I have a dictionary that looks like: a0,b0,c0,d0,e0 a1,b1,c1,d1,e1 .... .... Currently I consider (Class Tag) to be the key and (Class Value) to be the value. However I now need to use ...
3
by: SpreadTooThin | last post by:
I have a C routine that wants to call a method of its user. In this case the method is a method inside a class. The C routine is passed a void * which can be used by the user any way they like. I...
4
by: jimgardener | last post by:
hi am a beginner in python and PIL .I need to read an RGB 8 bit image (am using jpeg )and pack the rgb color values into a double value so i can store the image as a list of pixelvalues.From my...
4
by: Energizer100 | last post by:
public class fly extends Actor { public fly() { setColor(Color.BLACK); } public fly(Color flyColor) { setColor(flyColor);
20
by: d.s. | last post by:
I've got an app with two classes, and one class (InventoryInfoClass) is an object within the other class (InventoryItem). I'm running into problems with trying to access (get/set) a private...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.