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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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