Write a program that reads from keyboard a sequence

Assignment Help JAVA Programming
Reference no: EM131323849

Assignment

In this assignment, you are required to specify and implement a Java

The language is Java. In this assignment, you are required to specify and implement a Java class named IntSortedList. The instances of IntSortedList are sorted lists of integers. Each class in the program need a class invariant. There should be no limit on the length of the list. The operations on sorted lists of integers supported by IntSortedList are

• A default constructor that creates an empty list of integers.

• An operation named empty that determines if the sorted list is empty. The operation takes no argument and returns a Boolean value.

An operation named length that returns the number of items on the sorted list. The operation takes no argument and returns a positive integer.

• An operation named insert that inserts an integer to the sorted list while maintaining its sorted-ness. The operation takes the integer to insert as its only argument. It should always succeed.

• An operation named delete that deletes an integer from the sorted list. The operation takes the integer to delete as its only argument. It returns true if the integer was in the sorted list. Otherwise, it returns false. Only one

occurrence of the target is deleted by this operation.

• An operation named show that displays the integers in the sorted list on screen. Every row except the last one contains 8 integers separated by spaces.

The last row may contain less than 8 integers.

You are required to provide an array-based implementation of IntSortedList and write a program that makes use of IntSortedList. Follow the following steps.

1. Refine the above specification of IntSortedList by writing function prototypes for its operations and their pre/post conditions.

2. Write a class definition for IntSortedList. The only public methods in the class definition are those operations. The private members are instance variables that represent a sorted list of integers. Write an invariant on these instance variables as comments. You can have private methods that are auxiliary to public ones.

3. Write a program that reads from keyboard a sequence of positive integers that is ended with a negative integer. The positive integers are inserted into a sort list of integers when they are read. When the program finishes reading, it displays the following information on screen: (a) the number of positive integers that have been read; (b) the positive integers.

Reference no: EM131323849

Write a complete java program assuming that the variables gp

Write a complete java program Assuming that the variables gpa, deanList and studentName have been declared, you should read in the studentName and gpa from keyboard. Write an

Create a java program to demonstrate the use of iterator

Write a Java program (non-GUI preferred) to demonstrate the use of Iterator. The program should allow a user to do the following: Allow the reading of a collection of animal o

Write java program which will permit user to make selection

Write the Java Program which will permit the user to make selection. You will present user with two options to perform, then you will perform action selected by user.

Explain how a borderlayout manages its display area

Write a Java statement to make the window associated with the object from question 1 visible. Explain how a BorderLayout manages its display area. Explain how a FlowLayout man

Recognize one high severity vulnerability for computer

Recognize one high severity vulnerability for each computer (if there is one). Explain vulnerability and describe control(s) to minimize risk from vulnerability.

Determine statistics for a video game tournament

Write a program to determine statistics for a video game tournament and write a program to alphabetize a list of last names. The user will input an undetermined number of last

Write an application named us insurance

Write an application named UseInsurance that uses an abstract Insurance class and Health and Life subclasses to display different types of insurance policies and the cost per

Identify the first character of the name and lengthof length

Write a Java application that stores the names of your family and friends in a one-dimensional array of Strings. The program should show all names in upper case and lower case

Reviews

Write a Review

 
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