Q1: A student class should be implemented with the following details:
· Each object involves a set of fields/variables: (i) name, (ii) ID, (iii) programme of study, (iv) address, and (v) university name;
· Each object can execute two functions: (i) insert() that sets the objects’ values to the fields, and (ii) print() which prints the fields with their values.
· The assumption is that all the objects have the same university name’s value.
Copyright By PowCoder代写 加微信 powcoder
Q2: A class is implemented for the employees working at a university. The class has two sub classes: academic staff and research staff. It is also supposed that the student class in Q1 is a sub class of the research staff. Given these assumptions, implement the classes in accordance with the following information:
a) Employee class includes: Name, ID, address and University name fields. It has a function for inserting the fields’ values and a function for retrieving them.
b) Academic staff class inherits all the fields and functions declared/ defined in the employee class, and also has a specific filed called as position title. Furthermore, it contains a function for seeking a staff based on the ID and printing his/her information.
c) Research staff class inherits all the fields and functions declared/ defined in the employee class. It has a private variable for keeping research domains and a list for maintaining the list of researchers who works in a specific domain determined by an object. The class should implement a function for returning the staffs whose research are on the identified domain by an object. (The function name is search()).
d) Student class has a programme of study field and also contains those declared in the Research staff class. It has a function that returns the students’ IDs whose programme of study is computer. (The function name is search()).
Q3: Design a class called Meeting to represent meetings in a diary. The Meeting class has the following fields:
· time of the meeting represented as string in hours and minutes,
· location of the meeting (such as “room 205”),
· subject that represents the meeting’s subject (such as “Examiner’s meeting”).
Time, location and subject are stored as strings. The class should include a constructor and the following methods:
· setTime: to set the time.
· setLocation: to set the location.
· setSubject: to set the subject.
· getSubject: to return the subject of the meeting.
· printDetails: to print all information of a meeting in the following form:
Meeting in room 205 at 12:30; Subject: Examiner’s meeting.
Q4: Figure 1 illustrates a class for a shape that involves three sub-classes, namely rectangle, ellipse and triangle.
Fig. 1: Shape class and its sub classes
Given the figure and the details of classes:
(a) Implement an interface for the classes.
(b) Write the code for the area() functions and implement the main function, which tests the object’s areas regarding arbitrary arguments.
Q5: Create a priority queue class with the following methods:
(i) Find2(): return the second smallest value in the priority queue;
(ii) Delete(): remove the smallest value in the priority queue;
(iii) Insert(): add a value to the priority queue;
(iv) IsEmpty(): return a Boolean value indicating whether the queue is empty or not.
Note: In the priority queue, the elements are integer numbers that should be removed from the smallest value.
Q6: Create a stack class and add the functions below to it:
(i) void printStack(Stack s)—prints the elements in stack s from top to bottom. When printStack returns, s should be unchanged.
(ii) Stack reverseStack(Stack s)—returns a new stack whose elements are backwards from those in s. Again, s is unchanged.
(iii) Stack removeElement(Stack s, int val)—returns a new stack whose elements are the same as those in s (and in the same order) except that all occurrences of val have been removed. Again, s is unchanged.
Q7: Print a linked list in reverse order. You are given a Singly linked list, print the linked list in reverse way, from end to start.
Input: 10 -> 20 -> 30 -> 40 -> 50 -> null
Output: 50 40 30 20 10
Q8: Write a set of Java classes that can simulate an Internet application, where one party, Alice, is periodically creating a set of packets that she wants to send to Bob. An Internet process is continuously checking if Alice has any packets to send, and if so, it delivers them to Bob’s computer, and Bob is periodically checking if his computer has a packet from Alice, and, if so, he reads and deletes it.
Final Report: This consists of: A Technical Report giving the detailed response to each question. For the questions, include short explanation of designs for your solutions, UMLs, descriptions of analyses or implementations undertaken, details of testing and validation activities.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com