DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate

DiscussWorldIssues - Socio-Economic Religion and Political Uncensored Debate (http://www.discussworldissues.com/forums/)
-   General Discussion (http://www.discussworldissues.com/forums/general-discussion/)
-   -   Programming Question Part 2 (http://www.discussworldissues.com/forums/general-discussion/97034-programming-question-part-2-a.html)

PemiaGefe 10-23-2010 10:38 PM

Programming Question Part 2
 
Replace < with <

enencephoth 10-24-2010 03:12 AM

http://download.oracle.com/javase/1....l/Scanner.html

This has a better explanation of how to use a Scanner than I would write.

Amirmsheesk 10-24-2010 04:16 AM

Yes. You should make a Scanner on listings.txt and use it to read in all of the property types. Something like:

while (scanner.hasNextLine()) propertyType.add(scanner.nextLine());

EasyLOAD 10-24-2010 04:22 AM

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.

Si8jy8HN 10-24-2010 06:31 AM

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.

jisee 10-24-2010 10:40 PM

Have you though about choosing some other profession? If you can't wrap your head around some algorithms, maybe you're better off forging steel?

WrigleyMike 10-24-2010 11:02 PM

Right now after I put in my input file when running it it then asks for the output file which it shouldn't be doing. If I take out the while statement it runs fine again, so I'm doing something wrong with the while statement.

Infellgedq 10-25-2010 12:15 AM

dp

tiereenny 10-25-2010 12:50 AM

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.

67Irralphaisa 10-25-2010 02:47 AM

There is, of course, also get().

JohnMaltczevitch 10-25-2010 03:10 AM

You can't do this in one method call.


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0 PL2