Write a test application named labtest

Assignment Help Programming Languages
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).

Reference no: EM131321246

Questions Cloud

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.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create logic for program to count readers by genders

Create the logic for a program that would produce a count of readers by gender within age group - that is, under 20 females, under 20 males, etc.

  Program to output circle-s radius-diameter-circumference

Write a program to prompt the user to enter center and a point on circle. Program must then output circle's radius, diameter, circumference, and area.

  Write program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

  Write a prolog program that finds the ast item in a list

Write a Prolog program that finds the ast item in a list. Add a test query.

  Network programming

From where does the template class derived from in network programming?(

  Write program to prompt user to enter string of caharacter

Write a program that prompts the user to enter a string of 87 characters the program should display the middle character in the string if there is an odd number characters in the string.

  Write program to accept data in array with three structures

Develop and make a program which will accept above data in array with three structures. Once data have been entered, display report listing each employee number and salary of employee.

  What is a feature of good program design

Variables declared within a module have what scope? In what way do named constants differ from variables? What is a feature of good program design

  Program to display information about balance in account

Design an ordinary text file named solution06.txt. In that file, enter text required to make a web page that will display information about balance contained in family's account.

  Html5 assignment i need an assignment for html5 containing

i need an assignment for html5 containing 2 parts1 3 pages html5 website2 report more important than the website

  Design a gui that runs a simulink model

Use a numerical intergration to determine the distance x the airplane travels as a function of time. Make a plot of x versus time. Design a GUI that runs a Simulink model to solve questions (a) and (b).

  What causes an infinite loop and how do we break it

Write a loop to print all multiples of three from 0 to 100. What causes an infinite loop? How do we break it? Write a program to compute the impedance, Z, and inductance, L, of an electrical coil given voltage, V.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd