frank yang

Greenhorn
+ Follow
since Feb 19, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by frank yang

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 ]
20 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 ]

Originally posted by Peter den Haan:
I just answered your question here. Please don't post in more than one group -- people will waste their time giving answers that have already been given elsewhere. Time they could've spent helping out someone else.
- Peter


Dear Peter:
Thank u for ur reply and suggestion.
The reason why I post the same question in more than one group is I don't know my qustion which gorup can be posted,so I post two copies.
20 years ago
There is a table named channel in my database(sqlServer2000). It�s data structure as follow:
The letter c refers to channel.

Description:
Channel_is_father:If this column has children, it is inserted 1, otherwise 0.
Column1 is the top column, so it�s channel_father_id is set 0. However the column 3 is the second layer column. Its father is 102 named column2, and so on.
Ok. I want to get the data by the layer structure from database and to display on the web.
For example:

I wrote java codes to realize this function ,but failed. I don�t know why.
My codes:

Output as fellow:
Not Father101
***
Not Father113
***
Father102
Father103
Father106
Not Father109
***
***

The method channelIsFather is used to verify the column whether or not is father column.if so it return 1 ,but 0;
The method getChannelId is used to retrieve the channelID.If the channel_id is the father column, which will recall the the method itself again till the condition turned false.
Thank u very very much!
[ April 03, 2003: Message edited by: frank yang ]
20 years ago
There is a table named channel in my database(sqlServer2000). It�s data structure as follow:
The letter c refers to channel.

Description:
Channel_is_father:If this column has children, it is inserted 1, otherwise 0.
Column1 is the top column, so it�s channel_father_id is set 0. However the column 3 is the second layer column. Its father is 102 named column2, and so on.
Ok. I want to get the data by the layer structure from database and to display on the web.
For example:

I wrote java codes to realize this function ,but failed. I don�t know why.
My codes:

Output as fellow:
Not Father101
***
Not Father113
***
Father102
Father103
Father106
Not Father109
***
***

The method channelIsFather is used to verify the column whether or not is father column.if so it return 1 ,but 0;
The method getChannelId is used to retrieve the channelID.If the channel_id is the father column, which will recall the the method itself again till the condition turned false.
Thank u very very much!
20 years ago
Classes that implement the interfaces use different storage mechanisms.
the Hashing Supports insertion, deletion and growing the store. Indexed access is slower.
But searching is faster.
However, requires the use of unique keys for storing data elements.
Quote from chairyuan's notes
My question if two statement below
Q1 The elements in the collection are guaranteed to be unique.
Q2 The elements in the collection are accessed using a unique key.
I think both are coorect .But the Q2 is seemt to incorrect.
Pls tell me which is true?
Thank u very much!
When I assigned the task of building a panel containing a TextArea at the top, a label directly below it, and a button directly below the label.
If the three components are added directly to the panel, which layout manager that selected can the panel use to ensure that the TextArea absorbs all of the free vertical space when the panel is resized?
There are two layout manager can be used,i.e GridLayout and GridBagLayout.But I don't make decision .which should I select?And why?
Thank u

What is the result?
A. baz has the value of ��
B. baz has the value of null
C. baz has the value of �red�
D. baz has the value of �blue�
E. bax has the value of �green�
F. the code does not compile
G. the program throws an exception
I konw the arguments index starts with 0.In this case must report error.I think the correct answers is G that throws an exception.But the right is F because the declaration of variable retrieving the command line args also shoud begin with 0,i.e.String foo=args[0],otherwise compliation to fail.
who can give me a exact answers?
Thank u for ur helps.
[ February 19, 2003: Message edited by: frank yang ]
Thank u for ur helps
Best regards,
I came cross a question:
float f=-1;
float f=0x1203;
float f=012;
To my suprised,all is compliation to succeed.
why the primitive type of folat can declear are this way.
Thank u very much.
[ February 19, 2003: Message edited by: frank yang ]

What is the result?
A. Compilation will fail.
B. The program prints �0�.
C. The program prints �3�.
D. Compilation will succeed but an exception will be thrown at line 3.
I know the Primitives are passed by value and Objects (references) are passed by reference.
The object reference itself is passed by value. So, it can�t be changed. But, the object can be changed via the reference.
In this case the method add3(i) passed the reference But why the result still can't be changed.
Who can explian this problem?
Thank u very much.
public class SuperClass{
class SubClassA extends SuperClass{}
class SubClassB extends SuperClass{}
public void test(SubClassA foo){
SuperClass bar=foo;
}
}
which statement is true about the assignment in line 5?
A. The assignment in line 5 is illegal
B. The assignment in line 5 is legal, but throw a ClassCastException
C. legal and will always executes without throw an Exception
Which answer is correct?
Who can explain and give an example to run this code?
Thanks a lot
[ February 17, 2003: Message edited by: frank yang ]
Which statement about static inner classes is true?
A. An anonymous class can be declared as static.
B. A static inner class cannot be a static member of the outer class.
C. A static inner class does not require an instance of the enclosing class.
D. Instance members of a static inner class can be referenced using the class name of the static inner
class.
The right answer is C
But I want to know why the answer D is not correct?
Thank u very much