Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,547 members, 7,812,736 topics. Date: Monday, 29 April 2024 at 06:20 PM

Help Needed In Java Programming Assignment Please!!!!! - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help Needed In Java Programming Assignment Please!!!!! (2272 Views)

Pls Help With This Programming Assignment / I Want To Develop A Software In Java To Calculate CGPA / Java Programming For Dummies (2) (3) (4)

(1) (Reply) (Go Down)

Help Needed In Java Programming Assignment Please!!!!! by Nobody: 7:47pm On Nov 26, 2013
During his completely miserable life, pirate Abraham Blaufelt has been in search of the lost treasure of Atlantis. On a very fortunate day in the year of the Lord 1642 he enters an abandoned cathedral of a long gone sect in the ancient forests of Poland. Inside he finds a mysterious ancient parchment. The parchment reads:
Traveler, if you want to reach thine goal,
trace the path through seas by making the broken, whole.
5,4 4,5 8,7
Add behind 6,3 3,2 9,6 4,3
Add in front 7,6
Add behind 9,8
Add in front 5,5 7,8 6,5 6,4
Abraham Blaufelt immediately knew what he was dealing with. A puzzel of which the result is a safe route to the treasure. This route was essential, the sea was crawling with monsters in those days. Since this most fortunate day, almost four hundred years ago, the european tectonic plate has shifted signifi- cantly. As a result all coordinates have to be shifted by (1, 0).
Write a program that solves this puzzle. This has to be done in the following way:
Start with the coordinates on the first row, add the coordinates of the second row at the back, then add the coordinates of the third row in front etc. Make a new Coordinate and CoordinateRow class for this assignment. The latter class has methods to add a CoordinateRow in front or at the back and methods to add a single Coordinate at the front or at the back.
The coordinates of the puzzle are"5,4 4,5 8,7=6,3 3,2 9,6 4,3=7,6=9,8=5,5 7,8 6,5 6,4".
Every CoordinateRow is seperated from another by an '='. Every coordinate in a row is seperated by a space. The x and y values of a coordinate are seperated by a comma.
After all data has been read, the program will print the treasure route on the standard output. The correct route as out put would be:
6,5
8,8
7,5
7,4
8,6
6,4
5,5
9,7
7,3
4,2
10,6
5,3
10,8


Thanks in advance.
Re: Help Needed In Java Programming Assignment Please!!!!! by codeaddict(m): 10:23pm On Nov 26, 2013
What have you done so far?
If we all behaved this way while learning, nobody would be able to solve this, then.
Attempt something, no matter how small, it may seem. Then post it here, I'll correct, if it needs correction, and give you pointers.

1 Like

Re: Help Needed In Java Programming Assignment Please!!!!! by Nobody: 10:38pm On Nov 26, 2013
codeaddict: What have you done so far?
If we all behaved this way while learning, nobody would be able to solve this, then.
Attempt something, no matter how small, it may seem. Then post it here, I'll correct, if it needs correction, and give you pointers.
Thanks, I really appreciate it.... the thing is the only problem for me is the starting point.I mean I will start the program only if first I understand what they want me to do......
but anyways thanks I will try my best....
Re: Help Needed In Java Programming Assignment Please!!!!! by codeaddict(m): 10:59pm On Nov 26, 2013
Okay, what you need is to write a Coordinate class, with two Integer variabes - the xPoint, and the yPoint. Make them instance variables that'll be assigned in your constructor.

Then write a CoordinateRow class, with a List<Coordinate> variable. You could use any other generic class that supports inserting and appending, such as ArrayLists.

Include methods that perform the addition of coordinates. These methods will perform the same thing. However, while one adds to the front of the List, the other adds behind. These methods will take a String argument in the form (x,y). Tokenize the argument string based on ',' and then construct a Coordinate class with the integer values of each of the tokens(you could trim the tokens if white spaces might be present). Then depending on which position the method adds values to, you add appropriately to the List.

Include a method (say AddCoordinates) in the CoordinateRow class that takes in a String parameter(rows), and an argument specifying position. The latter argument could be an integer, boolean or anything that tells you where it'll be added - in front or behind. This method would have to split the String parameter by spaces to get the string value of each coordinate point (in the form 5,4). Then for each token(coordinate), you call appropriate methods to add in front or behind.

This method (AddCoordinates) could be called in your CoordinateRow constructor, with an argument to place it behind, thus effectively creating your initial row.

1 Like

Re: Help Needed In Java Programming Assignment Please!!!!! by Nobody: 11:08pm On Nov 26, 2013
codeaddict: Okay, what you need is to write a Coordinate class, with two Integer variabes - the xPoint, and the yPoint. Make them instance variables that'll be assigned in your constructor.

Then write a CoordinateRow class, with a List<Coordinate> variable. You could use any other generic class that supports inserting and appending, such as ArrayLists.

Include methods that perform the addition of coordinates. These methods will perform the same thing. However, while one adds to the front of the List, the other adds behind. These methods will take a String argument in the form (x,y). Tokenize the argument string based on ',' and then construct a Coordinate class with the integer values of each of the tokens(you could trim the tokens if white spaces might be present). Then depending on which position the method adds values to, you add appropriately to the List.

Include a method (say AddCoordinates) in the CoordinateRow class that takes in a String parameter(rows), and an argument specifying position. The latter argument could be an integer, boolean or anything that tells you where it'll be added - in front or behind. This method would have to split the String parameter by spaces to get the string value of each coordinate point (in the form 5,4). Then for each token(coordinate), you call appropriate methods to add in front or behind.

This method (AddCoordinates) could be called in your CoordinateRow constructor, with an argument to place it behind, thus effectively creating your initial row.

Thanks a million....I really appreciate your help...Now its really clear what I need to do...Thanks a lot.....

(1) (Reply)

A Universal Sdk For Finger Print Scanner / Javascript Source Code For GPA Calculator / R Language, S+ Or Spot Fire: I Need Introduction

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 33
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.