I really appreciate if anybody give me at least only pseudocode for this assignmet?
I would really appreciate if anybody at least tell me only pseudocode even it would be enough only the logic part at least 3-5 line code how to start how to compare the numbers each other i mean the tricky part of this assignmet.
This is the assignment.
-----------------------
Write a program SortCities, reading any number of cities with their corresponding postal numbers from a text file. You may assume that each line in the file contains one postal number (integer) and one city (string) and that they are separated by a semicolon (. Create a class City, representing a city. The class City should implement the interface Comparable.
Reading cities from file: C:\Temp\orter.dat
Number of cities found: 7
90325 Umeå
35243 Växjö
23642 Höllviken
72211 Västerås
51000 Jönköping
75242 Uppsala
96133 Boden
The output should be in order list like below;
23642 Höllviken
35243 Växjö
51000 Jönköping
72211 Västerås
75242 Uppsala
90325 Umeå
96133 Boden
Re: I really appreciate if anybody give me at least only pseudocode for this assignme
you mean like num_a < num_b? That's intrinsic in java and you shouldn't need to write your own low-level comparison code (at least not anything lower than that).
Note that you can only use < on number data types, not strings. To convert a string to an integer:
Code Java:
int number = Integer.parseInt("51234");
Re: I really appreciate if anybody give me at least only pseudocode for this assignme
Actually in this assingment is required something more advanced not only <>.
If anyone has any idea at least how to start comparing two lines which has numbers and to sort them.which is the smalletst one. as u can see on assignment what is required.
Re: I really appreciate if anybody give me at least only pseudocode for this assignme
When designing an algorithm, you should ask yourself: how would I do this in my head or with a pencil and paper? Pretend you have a friend who has no idea how to accomplish the goal, and write out the directions you would give him that he could follow, knowing nothing else, to do so.
When you have that written out, you should have an algorithm that should be pretty easy to translate into code.
Re: I really appreciate if anybody give me at least only pseudocode for this assignme
Again, it seems we're wasting our time, as this thread has already received help elsewhere:
This thread has been cross posted here:
http://www.java-forums.org/new-java/39414-can-somebody-help-me-assignment.html
Although cross posting is allowed,
for everyone's benefit, please read:
Java Programming Forums Cross Posting Rules
The Problems With Cross Posting