Results 1 to 2 of 2
Thread: Need help with Scanner/hasNext
- 03-17-2012, 11:48 PM #1Member
- Join Date
- Mar 2012
- Rep Power
Need help with Scanner/hasNext
Hey I'm new to java and having trouble with one of my assignments. I have a txt file that looks like this:
It's names with their corresponding sales listed consecutively. I have to calculate the payroll and display the output listing the names only in one column and Commission from sales in another. Iv'e figured out how to only get the names using hasNextDouble and nextLine. Otherwise it would keep giving me a Mismatched exception error because the first line is a string.
String str = inputFile.nextLine();
So my question is how do I extract the sales individually and store them so I can calculate commission/bonus? I can't hardcode any of the numbers and limited to using scanner only.
Any help is appreciated, thanks.
- 03-18-2012, 01:40 AM #2
- By kahwawashay in forum New To JavaReplies: 15Last Post: 05-12-2012, 09:16 AM
- By sandeep43 in forum New To JavaReplies: 7Last Post: 08-10-2011, 01:29 PM
- By N00Bie in forum New To JavaReplies: 6Last Post: 02-12-2011, 01:14 AM
- By scotts in forum New To JavaReplies: 4Last Post: 06-20-2010, 03:58 PM
- By ScKaSx in forum New To JavaReplies: 5Last Post: 01-27-2009, 11:11 AM