akosiraff

Download IntSortedList JAVA

Jul 27th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/intsortedlist-java/
  3. In this assignment, you are required to specify and implement a Java class named
  4. IntSortedList. The instances of IntSortedList are sorted lists of integers. Each class in the program need a class invariant. There should
  5. be no limit on the length of the list. The operations on sorted lists of integers
  6. supported by IntSortedList are
  7. • A default constructor that creates an empty list of integers.
  8. • An operation named empty that determines if the sorted list is empty. The
  9. operation takes no argument and returns a Boolean value.
  10. An operation named length that returns the number of items on the sorted list. The
  11. operation takes no argument and returns a positive integer.
  12. • An operation named insert that inserts an integer to the sorted list while
  13. maintaining its sorted-ness. The operation takes the integer to insert as its
  14. only argument. It should always succeed.
  15. • An operation named delete that deletes an integer from the sorted list. The
  16. operation takes the integer to delete as its only argument. It returns true if
  17. the integer was in the sorted list. Otherwise, it returns false. Only one
  18. occurrence of the target is deleted by this operation.
  19. • An operation named show that displays the integers in the sorted list on
  20. screen. Every row except the last one contains 8 integers separated by spaces.
  21. The last row may contain less than 8 integers.
  22. You are required to provide an array-based implementation of IntSortedList and
  23. write a program that makes use of IntSortedList. Follow the following steps.
  24. 1. Refine the above specification of IntSortedList by writing function prototypes
  25. for its operations and their pre/post conditions.
  26. 2. Write a class definition for IntSortedList. The only public methods in the class
  27. definition are those operations. The private members are instance variables
  28. that represent a sorted list of integers. Write an invariant on these instance
  29. variables as comments. You can have private methods that are auxiliary to
  30. public ones.
  31. 3. Write a program that reads from keyboard a sequence of positive integers
  32. that is ended with a negative integer. The positive integers are inserted into a
  33. sort list of integers when they are read. When the program finishes reading,
  34. it displays the following information on screen: (a) the number of positive
  35. integers that have been read; (b) the positive integers.
  36. Download: http://solutionzip.com/downloads/intsortedlist-java/
Add Comment
Please, Sign In to add comment