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

  Breach of security

A company has the resource XYZ. If there exist a breach of security, company may face a fine of $100,000 and pay other $20,000 in order to clean up the breach.

  What are the benefits of software engineering

What is the appropriate justification for an employee that can be submitted to his/her business line to persuade to accept the study of software engineering.

  Establish a formal evaluation criterion

Why would it be wise to build a formal evaluation criterion for a company to use when purchasing new hardware or software.

  Altering the dijkstra’s algorithm

Alter Dijkstra’s algorithm in order to compute the shortest paths from the source vertex s in O(W·|V|+|E|) time.

  Evaluates and contrast tcp and ud

Describe the need for the Transport Layer. Recognize the role of the Transport Layer as it provides the end to end transfer of data between applications.

  Tools that help in the attack

When initially collecting the information on a network, that reconnaissance tool or method do you believe would generate the best results include what information could you learn utilizing this tool or method and how could this information be used..

  How to explain capacity of the queue

How to explain capacity of the queue

  What are an ethical dilemmas associated

What are the ethical dilemmas associated with using facial recognition software? Is this kind of software any different from a store asking to see your drivers license when you use your credit card.

  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.

  Expand or contract the number of phases

What is the Software/System Development Life Cycle (SDLC) and can we expand or contract the number of phases depending on the particular project?

  Developing the lan for cpa firm

Instructed to develop a LAN for the very successful CPA firm with the five departments within one building and a total of the 560 employees, presently your team can offer.

  Computing the cryptosystem

Consider the following cryptosystems and compute which security service(s) (e.g. Authentication, Integrity…etc) they offer: Example: Ek(M) - Confidentiality

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