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

  Program for saving account balance report

Savings account balance report from customer savings account file. Every input savings account record contains account number, balance forward, deposits (sum of all deposits).

  Program development cycle

As the text explains, there are seven (7) steps in the Program Development Cycle. Identify which of the steps that you believe takes the most effort. Provide a rationale to support your response

  What are the five key steps in the programming process

Which features are commonly found in programming languages? What are the five key steps in the programming process

  Write program to match master and transaction methods

When writing a program to match master and transaction methods, what should happen when the value of the master key is equal to the transaction key?

  Projects for the falling letters game

Design and implement two projects for the Falling Letters game using C# and Windows Presentation Foundation (WPF) template in Visual Studio 2012 or newer.

  Invent a simple hash function. identify its weaknesses.

A client/server system requires remote users to use a password to log onto the server. Describe a simple scheme that would thwart eavesdroppers from obtaining and/or spoofing the password.

  Create program-ask user to enter amount of purchase

Create a program which will ask the user to enter the amount of a purchase. The program must then compute the state and county sales tax.

  Binary search algorithm to search an array

The binary search algorithm that follows may be used to search array when elements are in order. This algorithm is analogous to following approach for finding name in telephone book.

  Programming-create a calculator

Programming-Create a Calculator, Create a graphical calculator with buttons that can add, subtract, multiply, divide, +/-, Sin, Cos, Tan, clear and Modulus

  Define a class rewardcard as an adt

Determine the cost of the two_day_ package represented by the instantiated object, then display the calculated cost also on the console - Define a class RewardCard as an ADT that uses separate files for the interface and the implementation

  Find a way to have only a few fibonacci numbers in memory

Implement an iterative solution that runs in O(n) time and returns a pointer to a HugeInteger struct that contains F(n). Be sure to prevent memory leaks before returning from this function.

  Computes the wind-chill factor for a given temperature

The user should be able to enter a temperature and wind speed via text boxes, then click a button to view the corresponding wind-chill factor in a separate text box. As part of your page, you should define a function named Wi ndChi 11 that accepts..

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