posted 13 years ago

Test 004

1. A cost-map contains M*N cells, we have the cost rate for each individual cell.

2. The path is defined as a sequence of cells that connect to each other directly.

3. If two cells are in the same row or column, and there is no cell between them, these two cells are defined as directly connected.

4. The cost of a path is the summary of all the cells� costs involved.

lYou are required to find out a cheapest path from one specified cell to another.

lRequirement:

1. Based on the existing partial system (described below), design and implement your module to solve the problem.

2. Document the API of your module.

3. Draw the relevant UML diagrams for your design.

4. Finish the implementation using language of Java

5. Document your consideration for the performance in your design, because this program may run on devices with limited memory and calculation capabilities.

lThe existing partial system

Map

M: intN: int

getCell(int row, int col): CellgetStartCell(): CellgetTargetCell(): Cell

M: is the row number of the map

N: is the column number of the map

getCell returns the Cell with row and column specified. The start index is 0.

getStartCell and GetTargetCell return the start and end cell of the problem.

Cell

row: intcol: int

getCost(): int

Trace

getTraceLength(): intgetCell(int n): CellgetCost(): int

getTraceLength returns how many cells are involved in this trace.

getCell returns the number n cell in this trace.

getCost returns the total cost of this trace.

[ February 10, 2004: Message edited by: frank yang ]

1. A cost-map contains M*N cells, we have the cost rate for each individual cell.

2. The path is defined as a sequence of cells that connect to each other directly.

3. If two cells are in the same row or column, and there is no cell between them, these two cells are defined as directly connected.

4. The cost of a path is the summary of all the cells� costs involved.

lYou are required to find out a cheapest path from one specified cell to another.

lRequirement:

1. Based on the existing partial system (described below), design and implement your module to solve the problem.

2. Document the API of your module.

3. Draw the relevant UML diagrams for your design.

4. Finish the implementation using language of Java

5. Document your consideration for the performance in your design, because this program may run on devices with limited memory and calculation capabilities.

lThe existing partial system

Map

M: intN: int

getCell(int row, int col): CellgetStartCell(): CellgetTargetCell(): Cell

M: is the row number of the map

N: is the column number of the map

getCell returns the Cell with row and column specified. The start index is 0.

getStartCell and GetTargetCell return the start and end cell of the problem.

Cell

row: intcol: int

getCost(): int

Trace

getTraceLength(): intgetCell(int n): CellgetCost(): int

getTraceLength returns how many cells are involved in this trace.

getCell returns the number n cell in this trace.

getCost returns the total cost of this trace.

[ February 10, 2004: Message edited by: frank yang ]

Look at me and hear me<br />Because I am here<br />Just for that

posted 13 years ago

Frank-

Two things...

Here at the JavaRanch we're always more than happy to help. Help you to understand what the question is, help you to understand why your solution won't work, help you to fix bugs, that kind of thing.

If you'd like to explain what you've tried, explain how you've gone about trying to solve it yourself... we'd be more than happy to help you along, but we won't just give you the answer, get it?

I'm moving this to the Java In General (Intermeidate) forum, seeing as though this has nothing to do with Certification.

Two things...

**1st thing:**Here at the JavaRanch we're always more than happy to help. Help you to understand what the question is, help you to understand why your solution won't work, help you to fix bugs, that kind of thing.

*But, we will NOT do your homework for you.*If you'd like to explain what you've tried, explain how you've gone about trying to solve it yourself... we'd be more than happy to help you along, but we won't just give you the answer, get it?

**2nd thing:**I'm moving this to the Java In General (Intermeidate) forum, seeing as though this has nothing to do with Certification.

- Jess

Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep