打印

帮一朋友问的几道JAVA题目

帮一朋友问的几道JAVA题目

我是一点也不懂,谢谢大家了。

PART 1

All the answers are in blue colour.
You are required to explain the term, and concept found in Java language environment. You need to give examples of your own.

i) Overloding constructor
Overloading constructor is when more than one constructor having the same name, but taking different arguments.
public animal(String id, String name){this.id = id; this.name = name;}
public animal(String name) {this.name = name; id = “n/a”;}
ii) Overidding methods
Overriding methods is when a method from a subclass overrides the super class method, for which the argument and return type are exactly the same.
public String toString() {…}
iii) Interface
Interface used to define a protocol of behaviour that can be implemented by any class anywhere in the class hierarchy.
public interface Vehicle { public void NumofWheels(int wheels); }
iv) Abstract method
A method that has no implementation
abstract void PeopleTalking();




PART 2

a)

Create a class Student which contains the following
Student id
Student name
Center code
Payment
This class will be used to support single link list implementation.
Also include the constructor, accesor, and mutator methods for the Student class.

b)

public class StudentList
{

private Student startingnode;

}

You are required to write methods to manipulate the information found in the link list defined above.
Constructor
Add method
Printing method which will display minimum 3 type of student details
Searching method which serach base on student id
SumPayment method which show the total payment made by all the students
Other method


c ) Write a program that demonstrates that you are able to activate all the methods writen above.

Student System
1) Add new Student movie
2) Search StudentMovie
3) Student Report
4) Total Payment
5) Others method
6) Exit

Take note: Student required to come out with their own function. This is to encourage to have interest in writing Java solution.





PART 3

Mike Laudrup owns a shop provides pets services. His shop organisation requires you to develop an application to keep track the type of pets taken care by his pet.


a) You decided to identify each pets taken care base on certain idenfication code.. Create a class called PetIdentity that stores the following information:

• PetType : a 1-character category type that represents C for cats, H for horses phone , and F for fish.
• NRIC : a 8-digit number that represent the pet owner identification code (you may store it as characters)
Include the constructor to initialise all the data.



b) The owner of this company would like to store the following information for each of his pets item:

• PetCode : of PetType above
• Service type : can store up to a maximum of 50 characters
• Duration : a 2 digit number
• cost : floating point number

Create a class called PetsRecord that stores the above information:
Include the constructor to initialise all the data.
c) State all the accessor methods that must defined for the class PetsRecord.

d) Declare an array called KiwyPets that can store up to 300 PetsRecord object .

e) Write a function called SearchPets that take in KiwyPets array, an integer parameter numrec which holds the number of pets found in the pets shop and a character parameter called petType. The function should display the relevant the pet type information


f) This last part requires them to come with a new function that is able to manipulate the above KiwyPets information. Hint:The codes should not only display information。






PART 4

You are supposed to implement a dynamic stack that make use of single link list of number type.
a) i) Declare a class NumberNode which contains 2 members. First member is datum if integer type, and second member link which reference to next number in the link list.
ii) Implement the constructor to initialise the data.
iii) Implement all the accesor, and mutator methods found in the class
b) i) Declare a class PowerStack which contains a member top which reference to the top element in the power stack.
ii) Implement a method push to add a new item to the stack
iii) Implement a method PrintAll which will display all the data found in the stack
iv) Implement another method which can be use to manipulate the data in the stack.

TOP

好难哟

TOP

难!

TOP

晕啊。要是中文还能讨论一下!

TOP

理解不是很透彻 没法说了

TOP

本功能由奇虎搜索实现

相关主题

标题 作者 最后发表
[站外] 百度贴吧发贴工具破解版www.haobig.com   [转帖] 熠炎差 2008-11-30
[站外] 紧张的毕业论文选题   [转帖] 毕业论文 2008-11-29
[站外] 转帖 李开复为青年指点迷津:与未来同行   [转帖] 蛩乐斋主人 2008-11-30
点击阅读更多关于的相关帖子  更多相关主题