Prepare a program for sorted list

Assignment Help JAVA Programming
Reference no: EM13810199

Code a doubly links, sorted list (in ascending order). Each item of the list will just store int. You need to code three classes: Node, SortedList, and GroupProject, 

The Node class has three instance variables, all private:

*an int, representing the value stored inside the Node

*a Node (next)

*Another Node (previous)

The methods to code are : constructor (at least one), assessors, mutators.

The SortedList class is a doubly linked list, sorted in ascending order. it has two instance variables, both private:

*an int, representing the number of items in the list

*a Node, representing the head node in the list

The methods to code are:

*insert: this method takes one parameter, an int; it has a void return value.

*delete: this method takes one parameter, an int; it returns a boolean value. If we were successful in deleting the item (ie., the value of the parameter was found in the list), then we return true; if we were not successful, then we want to output a message that the value was not found, and therefore, not deleted, and return false.

*toString: this method takes no parameters and returns a String representation of the list.

*constructor (at least one), and assessors and mutators as appropriate.

All methods should keep the list sorted in ascending order.

The GroupProject class contains the main method; it should do the following:

*create SortedList object reference

*insert successively the values 25, 17, 12, 21, 78, and 47 in the sorted list

*output the contents of the sorted list using the toString method (obviously, 30 will not be found)

*output the contents of the sorted list using the toString method

*delete from the sorted list the value 21, using the delete method

*output the contents of the sorted list using the toString method

Your insert and delete methods should work properly in all possible scenarios: inserting in an empty list, inserting at the beginning of a list, inserting in the middle of a list, inserting at the end of a list, deleting from an empty list (cannot delete), deleting an item not in the list (cannot delete), deleting the first item in a list, deleting in the middle of a list, deleting the last item in a list.

Reference no: EM13810199

Questions Cloud

Major criticism of managed care : Which of the following is a major criticism of managed care? When patients have multiple health problems, this is called:
How to validate the organizational vision : How you intend to validate the organizational vision, mission, and values statements
Find the location of weight : The center of gravity of two particles of masses 14 kg and the 13kg is located at (3,-4)m. the 14 kg particle is located at the point (4,-1), find the location of 13kg
Define the most important external environmental factor : Identifies and analyzes the most important external environmental factor in the remote, industry, and external operating environments
Prepare a program for sorted list : Code a doubly links, sorted list (in ascending order). Each item of the list will just store int. You need to code three classes: Node, SortedList, and GroupProject
Identify the best value discipline and generic strategy : Identify the best value discipline, generic strategy, and grand strategy for your organization. Recommend a strategy or combination of strategies the organization should implement.
Identify and describe prevention strategies : Identify and describe two prevention strategies - Explain ways of determining whether loved ones have a problem with drugs using the DSM-IV-TR characteristics of substance abuse and dependence.
Define organizational change management strategies : Any required organizational change management strategies that would enhance successful implementation. Key success factors, budget, and forecasted financials, including a break-even chart
What is the mass : A spring with negligible mass stretches 34.0 cm when a 144 g gram mass is suspended from it. Now I suspend a mass m from the spring. If it oscillates at an angular frequency of 4.51 rad/s, what is the mass?

Reviews

Write a Review

JAVA Programming Questions & Answers

  User enter a series of numbers

Design a java program with a loop that lets the user enter a series of numbers. The user should enter - 99 to signal the end of the series. After all the numbers have been enter been entered, the program should display the largest and smallest number..

  Define render a model scene in java

Render a Model Scene in Java - Imagine you are prototyping animation for a Jurassic Park Movie

  Find what kind of output best shows off the operation

Find what kind of output best shows off the operation of these classes, and write a program that produces that kind of output.

  Pass in the number of gallons on board

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Days alive calculator

The context for this assignment (all parts) is a ‘Days Alive Calculator' - a small desktop application for calculating the number of days someone has been alive based on the date of birth and a second date, which may be today's date or some other ..

  What method do you use to set the location of a frame

Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button.

  Design a class named magazinesubscription

Design a class named MagazineSubscription that has fields for a subscriber's name, the magazine name, and number of months remaining in the subscription.

  Write a program comprising classes

Write a program comprising three classes: MonteCarlo (with the main() method), Simulation, and Metrics.

  Java program to implement currency converter

Write a JAVA program that helps the user convert currency. The user will enter the amount in Kuwaiti dinars. The program will print the equivalent amount in US dollar and Euros count his change.

  Using an array in java

Using an array in Java - have a list of keywords from a web service and have to print out the list of keywords on the screen with one keyword on each line. This is my code

  Java program editing

Prompt the user for the student's score and put that value into an object

  Create a structure named dog with a string field

Create a Structure named dog with a string field for the Dog's name. Create a Structure named Cat with a string field for the Cat's name.

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