Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: I really appreciate if anybody give me at least only pseudocode for this assignmet?

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default 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:
    int number = Integer.parseInt("51234");

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default 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.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default 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

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Trying to Give Coins For Change
    By bengregg in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 27th, 2011, 04:21 PM
  2. how to give inputs to my simple java program
    By pokuri in forum What's Wrong With My Code?
    Replies: 11
    Last Post: January 8th, 2011, 07:36 PM
  3. Sting format give more truble
    By ahmethbaai in forum Java Theory & Questions
    Replies: 1
    Last Post: December 17th, 2009, 01:19 PM
  4. New give thanks feature
    By JavaPF in forum The Cafe
    Replies: 0
    Last Post: April 11th, 2009, 11:14 AM