Basically, I'm a high school student who is aiming to go to University to study Computer Science next year. So sometimes in my spare I like to play around with codings in Java using Netbeans for example. So I have been using a textbook to assist me (Beginning Java objects, borrowed that from local library) and I have come across an example which has completely caught me out and makes me look like a super noob.
I googled around a bit but couldn't find anything.
The question kind of looked like this:
So for example, a research institution wants to make a graphical display to show how many high blood pressure patients were at a different stage of BP (in systolic mm Hg) at a certain time. The program should let you enter in the different heart beat rates until the entered value exceeds 230 (the maximum value in the blood pressure chart). The program should display a histogram and like the following: 140-159 ******** 160-179 *** 180-209 *** 210-230 * I used 15 patients in this case and the stars obviously stand for one each.
I guess that there are several ways that this could be done. One might be to write a class with a main method and to execute it in the usual way. In the main method create an empty list of integers and then create a loop that repeatedly asks the user to enter a number (the heart rate) and stores the number on the list. If the user enters a nmber over 230 then the loop exits. Finally create another loop that counts all the heart rates in the 0-10 range and prints that line, looping around and adding 10 to the start and endpoints of the range and printing a line until 230 is reached.
If you're working your way through the book then each of the constructs required should already have been explained, otherwise come back here if you have a more specific question.