General Discussion Undecided where to post - do it here. |
Reply to Thread New Thread |
![]() |
#2 |
|
http://download.oracle.com/javase/1....l/Scanner.html
This has a better explanation of how to use a Scanner than I would write. |
![]() |
![]() |
#3 |
|
|
![]() |
![]() |
#4 |
|
Oh, sorry, I misread the OP.
So, initially the Set propertyType will be empty. You don't know the different property types before you read listings.txt. So instead it looks like this: Code: Code
int property; int agent; double price; String type; while (scanner.hasNextLine()) { property = scanner.nextInt(); type = scanner.nextString(); price = scanner.nextDouble(); agent = scanner.nextInt(); // do what you need to do with these values } If you were reading through listings.txt normally (in notepad or whatever), and trying to construct an agentreport.txt file according to their spec, what would you do? Then code that. |
![]() |
![]() |
#5 |
|
I'm really at a point where I just don't know what the **** to do. It's not even covered in the ****ing book or course but I'm being asked to do it. What kind of ****ing piece of **** course is this? I'm so ****ing tired of this ****ing ****. There's no ****ing reason for this ****.
Here's my code: while (console.hasNextLine()) { property = console.nextInt(); type = console.next(); price = console.nextDouble(); agent = console.nextInt(); propertyType.add(type); } I don't understand how the **** this thing knows to disregard stuff and keep on moving and only entering in the things it needs. There's no ****ing explanation anywhere for this ****. I've ****ing had it. |
![]() |
![]() |
#7 |
|
|
![]() |
![]() |
#8 |
|
|
![]() |
![]() |
#9 |
|
idMap.put(agent, price);
This line is wrong. Not in the sense of you are calling a function wrong, etc. but in the sense that you algorithm should do something different. Imagine, for a moment, that you were doing this on paper and were creating (and updating) a table of agent/total price pairs as you read in the input file. If you saw agent ID 007, what would you do? Then do that in code. |
![]() |
![]() |
#10 |
|
|
![]() |
![]() |
#11 |
|
|
![]() |
Reply to Thread New Thread |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|