return to tranceaddict TranceAddict Forums Archive > Main Forums > Chill Out Room

 
Help with Java?
View this Thread in Original format
Evil_Gnome
I have a java assignment that I am working on and and I am stuck. If there is anybody that could help I would appreciate it. This is an first level java class so its nothing to crazy. Any help would appreciated.
rT19
you came to the right place
Evil_Gnome
i figured i would try here all the people on actual java forums are s.
LeopoldStotch
post what you need, and we'll help you. :p
Evil_Gnome
Well basically i need to ask for the sales of 5 stores then put that input into a horizontal bar chart using asterisks where each asterisk =$100.
Something like:
Store 1: ****
Store 2: ******
Store 3: ***
etc.
etc.

I can't figure out the asterik part of the program. Any help?
LeopoldStotch
quote:
Originally posted by Evil_Gnome
Well basically i need to ask for the sales of 5 stores then put that input into a horizontal bar chart using asterisks where each asterisk =$100.
Something like:
Store 1: ****
Store 2: ******
Store 3: ***
etc.
etc.

I can't figure out the asterik part of the program. Any help?


code:
/** * Purpose: print the asterisks * @param storeNumber the store number * @param inputString the user input string */ public void printAsterisk(String storeNumber, String inputString) { if (inputString != null && inputString.length() > 0) { // convert the input string as an int int inputStringAsInt = Integer.parseInt(inputString); // get the number of asterisks to output // get the mod of the input int numAsterisks = inputStringAsInt % 100; // output System.out.print(String.format("Store %s:", storeNumber)); for (int i=0; i < numAsterisks;i++) { System.out.print("*"); } System.out.println(""); } }


this will help you a bit.

/edited
use Integer, rather than String.
Evil_Gnome
yes thank you :wtf:
LeopoldStotch
edited.
Krypton
quote:
Originally posted by rT19
you came to the right place


He sure did!:haha:
Evil_Gnome
LeopoldStotch thank you for your help I just finished the program.

LeopoldStotch
no problem.

you know people who love to listen to trance are nerds! :o :p
CLICK TO RETURN TO TOP OF PAGE
 
Privacy Statement