Write down the definitions for the member functions

Assignment Help Computer Engineering
Reference no: EM1327441

Use the following shell class SList, and complete its implementation as per the guidance in points 1 through 5. Read the documentation on the member function declarations carefully.

public class SList
{
// Methods
public void insert(int item);
// Pre: The list is not full
// item is not in the list
// Post: item is in the list; the items are in sorted order
public void printList()
// Post: If the list is not empty, the elements are
// printed on the screen; otherwise "The list
// is empty" is printed on the screen
public int getLength()
// Post: return value is the number of items in the list
public boolean isEmpty()
// Post: returns true if list is empty; false otherwise
public boolean isFull()
// Post: returns true if there is no more room in the
// list; false otherwise
SList(int maxItems)
// Constructor
// Post: Empty list is created with maxItems cells
// Data fields
private int numItems;
private int[] values;
}

1: Write the definitions for the member functions.

2: Write a driver program that reads values from file int.dat, stores them in the list, and prints them on the screen.

3: Add a boolean method "contains" to class SList that returns true if its parameter is in the list and false otherwise. Use the binary search algorithm.

4: Add a private variable currentItem to the list and implement these method headings. This combination allows the user to view the list items, one at a time.

public void resetList()
// Set currentItem to 0
public String next()
// Returns the item at values[currentItem]
// Increments currentItem
public boolean hasNext()
// Returns true if currentItem is not equal to numItems

5: Augment the driver in point 2 to demonstrate how to use resetList, hasNext, and next to print the list.

Reference no: EM1327441

Questions Cloud

Decribe the functions of a network node manager : Explain the processes that take place during network discovery and mapping.
Explain operations management- amazon : Explain Operations management- Amazon and write an executive summary on the paper and review the status of the business today
Explaining the glass ceiling affect : Provide explanation of what the glass ceiling affect is, a brief history of it and how minorities and women are affected by it with examples.
Estimating debit cost of capital : Write down the two methods for estimating debit cost of capital, and what do you do when there's default risk?
Write down the definitions for the member functions : Add a boolean process "contains" to class SList that returns true if its parameter is in the list and false otherwise. Use the binary search algorithm.
Should information on the internet be unrestricted and why : Important information about Should information on the Internet be unrestricted - Should information on the Internet be unrestricted? Why or why not?
Elucidate price every ride must the public transportation : Elucidate price every ride must the public transportation authority charge to eliminate the deficit if it cannot reduce costs
Give an example of problem versus policy issue : Give an example of problem versus policy issue. What are the strengths and constraints of evidence-based policy analysis?
Why should a business use microsoft xp pro : Why should a business use Microsoft XP pro - Advantages and disadvatages compared to the others.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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