Reference no: EM131321246
Lab: Stacks
Lab Exercise:
Implement the following classes:
Class Course that includes three instance variables:
private int ID; // course ID
private String Name; // course name
private Course next; // link next
Your class should have the following:
A constructor that initializes the two instance variables id and name.
Set and get methods for each instance variable.
class Department that includes two instance variables:
private String deptName;
private Course top;
Your class should have the following:
a constructor that initializes the department name
public boolean exist(int id)that checks whether the course object with id passed as parameter exists in the stack or not.
Public Boolean push(int id, String n)that creates and adds the course if the course with id passed as parameter does not exist in the stack.
The course must be added to the top
private void push(Course temp) that inserts a node given as a parameter into the stack.
Public Course pop()removes the top element from the stack if it exists and returns it to main; otherwise, return null.
Public String findCourse(int id) that returns a course name if the id exists in the stack.
Public void print()that prints the department name and all the courses in the stack.
public void print Reverse()that prints the department name and all the courses in the stack in reversed order.
Write a test application named LabTest. In the main method, do the following:
Input the department name then create a department object.
Display a menu to the user and asking for a choice to be entered. As follows:
The program can perform the following:
1- push a course
2- pop a course
3- search for a course
4- print stack
5- print stack in reverse
6- exit
Please enter your selection:
The program will perform the action selected by the user and display a proper message when necessary.
The program will repeat these actions until the user terminates the program (Hint: Use a loop).
Acceleration and the change in time
: An elevator is moving downwards at 4m/s when suddenly someone hits the stop button and it travels another 2.9 m before coming to a rest. Please solve for the acceleration and the change in time.
|
Design and conduct if possible an archival research study
: Design, and conduct if possible, an archival research study. Consider what type of information you will look for, how you will find it, and how it should be content coded.
|
Relationship between electron orbital energy levels
: Describe the relationship between electron orbital energy levels and the energy of light that electrons emit for atoms in a gas.
|
What are the practical uses of the effect-size statistic
: What is the likelihood of a Type 1 error if the null hypothesis is actually true? What is the likelihood of a Type 1 error if the null hypothesis is actually false?
|
Write a test application named labtest
: Write a test application named LabTest. In the main method, do the following: Input the department name then create a department object. Display a menu to the user and asking for a choice to be entered.
|
Gravitational acceleration at the surface
: Let g0= magnitude of the gravitational acceleration at the surface of the Earth, R = radius of the Earth, and h = height above the Earth's surface
|
Create a 20-item likert scale to assess it
: Compute the scale's reliability, and then, using a statistical software program, delete items until the scale's reliability reaches at least .75 or stops increasing. Consider what sources of random and systematic error might be found in the scale.
|
When and why would nonprobability sampling methods be used
: Under what conditions is sampling bias likely to occur, what are its effects on generalization, and how can it be avoided?
|
Create java application to add a contact into contact table
: Develop a Java application to add a contact into the contact table, and display all contacts in the contact table. The contact table contains two columns, FullName, and PhoneNumber. Both values are text data.
|