Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9202811

Have any Question?


Related Questions in Computer Engineering

Question what are the risks of transmitting data over an

Question : What are the risks of transmitting data over an unsecured Wi-Fi network? What steps are necessary to secure Wi-Fi Protected Access Network? Distinguish between client/server and file server architecture. Is te ...

What statistic was calculated to determine differences

What statistic was calculated to determine differences between the intervention and control groups for the lumbar and femur neck BMDs? Were the groups significantly different for BMDs?

Question discuss in your own words using 250 words or more

Question: Discuss, in your own words using 250 words or more, the relationship between users and roles in databases. Explain why we use roles rather than simply assigning rights and privileges to each individual user. Th ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

Elmers utility function isnbspuxnbspy minxnbspy2 if the

Elmer's utility function is  U ( x ,  y ) = min{ x ,  y 2 }. If the price of  x  is $10 and the price of  y  is $15 and if Elmer chooses to consume 4 units of  y , what must his income be? a. $220 b. $100 c. $320 d. Ther ...

Question 1 emergency operations- a major hurricane has

Question 1: Emergency operations - A major hurricane has struck the area where your company has its central data center. There are offsite backups and hardware at three other centers around the country. - Assume that the ...

Submit a 2- to 3-page paper in which youidentify an

Submit a 2- to 3-page paper in which you: Identify an intercultural area Intercultural interaction with a person from a culture different from your own. Explain why you have selected this area. Describe your personal cul ...

Cullumber inc has issued a three-year bond that pays a

Cullumber, Inc., has issued a three-year bond that pays a coupon rate of 7.3 percent. Coupon payments are made semiannually. Given the market rate of interest of 4.4 percent, what is the market value of the bond?  (Round ...

Number of cars average trvel time between a and b using

Number of cars Average trvel time between A and B using route 1 1 10 2 10 3 10 4 11 5 12 6 14 7 18 8 24 Alternative route 2: average travel time is 18 minutes(no matter how many cars are using it) How many cars will take ...

Start your c development tool and view the swatthebugs16cpp

Start your C++ development tool and view the SwatTheBugs16.cpp file. The file is contained in either the Cpp7\Chap05\Swat TheBugs16 Project folder or the Cpp7\Chap05 folder. (Depending on your C++ development tool, you m ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As