Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java UML Diagram - public static final int MAX_BULLETS =5 - private string title - private string[] bullets - private double duration - public

In Javaimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

UML Diagram - public static final int MAX_BULLETS =5 - private string title - private string[] bullets - private double duration - public Slide() - Brief. - Default constructor. - Postconditions: - This object has been initialized to an empty slide (title and all bullets are null, duration =0.0 ) - You may create a custom constructor which takes arguments if you wish. - public string getTitle() - Brief: - Public getter method for the title member variable. - The title of the slide. - public void setTitle (string newTitle) - Brief: - Public setter method for the title member variable. - Parameters: - newTitle - The new title of this slide. This parameter should not be null - Preconditions: - newtitle is not null. - IllegalArgumentException - Thrown if newtitle is null. - public double getDuration() - Brief. - Public getter method for the duration member variable. - The duration of the slide. - public void setDuration(double newDuration) - Brief: - Public setter method for the duration member variable. - Parameters: - newDuration - The new duration of this slide. This parameter should be greater than 0 . - Preconditions: - newDuration is greater than 0 . - Throws: - IllegalArgumentException - Thrown if newDuration is less than or equal to 0 . - public int getNumBullets() - Brief: - Gets the total number of bullet point in the slide. - Returns: - The number of bullet points in the slide. - Note: - This method counts the number of non-null elements in the bullets array. - public string getBullet(int i) - Brief: - Gets the bullet point at index i. - Parameters: - i - The index to retrieve from the array. This value must be between 1 and mAX_BULLETS, inclusive. - Preconditions: - 1i MAX_BULLETS. - Returns: - The string representing the bullet point at the given index (may be null, meaning there is no bullet point at this index). - Throws: - IllegalArgumentexception - Thrown if i is not in the valid range. - public void setBullet (string bullet, int i) - Brief: - Parameters: - bullet - The string to place as the ith bullet point in bullets. This parameter may be null, indicating that the bullet at index i is to be erased from the slide. - i - The index to place bullet in the array. This value must be between 1 and MAX_BULLETS, inclusive. - Preconditions: - 1i MAX_BULLETS. - Postconditions: - The bullet point at index i has been updated to the string bullet. - There are no holes in the bullets array. All bullet points occupy the lowest possible indices of the array. previous and next SlideListNodes in the list. The class will be based on the following ADT specification: - private slide data - private SlideListNode next - private SlideListNode prev - public SlideListNode (Slide initData) - Brief: - Default constructor. - Parameters: - initData - Preconditions: - initData is not null. - Postconditions: - This SlidelistNode has been initialized to wrap the indicated slide, and prev and next have been set to null. - Throws: - IllegalArgument Exception - Thrown if initData is null. - public slide getData() - Brief: - Gets the reference to the data member variable of the list node. - Returns: - The reference of the data member variable. - public void setData(Slide newData) - Brief: - Updates the data member variable with a reference to a new slide. - Parameters: - newData - Preconditions: - newData is not null. - Throws: - IllegalArgument Exception - Thrown if newData is null. - public slidelistNode getNext() - Brief. - Gets the reference to the next member variable of the list node. - Returns: - The reference of the next member variable. Note that this return value can be nu11, meaning that there is no next s1ideListNode in the list. - public void setNext(SlideListNode newNext) - Brief. - Updates the next member variable with a new slideListNode reference. - Parameters: - newnext - Reference to a new slidelistNode object to update the next member variable. This parameter may be null, since it is okay to have no next slideListNode (this means we've reached the tail of the list!). - public slidelistNode getPrev() - Brief. - Gets the reference to the prev member variable of the list node. - Returns: - The reference of the prev member variable. Note that this return value can be nu11, meaning that there is no previous s1idelistNode in the list. (this means we've reached the head of the list!). - public void setPrev(SlideListNode newPrev) - Brief. - Updates the prev member variable with a new slideListNode reference. - Parameters: - newPrev. - Reference to a new slidelistNode object to update the prev member variable. This parameter may be nu11, since it is okay to have no previous s1idelistNode (this means we've reached the head of the list!). all slides in the list - private slidelistNode head - private slidelistNode tail - private slideListNode cursor - public SlideList() - Brief: - Default constructor which initializes this object to an empty list of slides. - Postconditions: - This slidelist has been initialized with head, tail, and cursor all set to null. - public int size() - Brief: - Returns the total number of slides in the slideshow. - The count of all slides in the slideshow. - This method should run on O(1) time. - public double duration() - Brief: - Returns the total duration of the slideshow. - The sum of all individual slide durations in the slideshow. - Depending on the implementation, this method may run in o(1) or o(n) time. both will be accepted.. - public int numBullets() - Brief: - Returns the total number of bullet points in the slideshow. - Returns: - The sum of all bullet points of all individual slides in the slideshow. - Depending on the implementation, this method may run in O(1) or o(n) time. both will be accepted.. - public slide getCursorslide() - Brief: - Gets the reference to the slide wrapped by the slideListNode currently referenced by cursor. - Returns: - public void resetCursorToHead() - Brief: - Returns the cursor to the start of the list. - Postconditions: - If head is not null, the cursor now references the first SlideListNode in this list. - If head is null, the cursor is set to null as well (there are no slides in this list). - public void cursorForward() - Brief: - Moves the cursor to select the next slidelistNode in the list. If the cursor is at the tail of the list, this method throws an exception (this includes the case where cursor and tail are both nul1). - Throws: - EndofListException - Thrown if cursor is at the tail of the list. - public void cursorBackward() - Brief: - Throws: - EndofListexception - Thrown if cursor is at the head of the list. - public void insertBeforeCursor (Slide newSlide) - Brief: - Inserts the indicated slide before the cursor. - Parameters: - newslide - The slide object to be wrapped and inserted into the list before the cursor. - Preconditions: - newslide is not null. - Postconditions: - newslide has been wrapped in a new SlideListNode object - If cursor was previously not null, the newly created slidelistNode has been inserted into the list before the cursor. - If cursor was previously null, the newly created slideListNode has been set as the new head of the list (as well as the tail). - The cursor now references the newly created SlideListNode. - Throws: - IllegalArgumentexception - Thrown if newslide is null. - Warning - public void appendToTail (Slide newSlide) - Brief: - Inserts the indicated slide after the tail of the list. - Parameters: - newslide - The slide object to be wrapped and inserted into the list after the tail of the list. - Preconditions: - newslide is not null. - Postconditions: - newslide has been wrapped in a new slideListNode object - If tail was previously not null, the newly created slidelistNode has been inserted into the list after the tail. - If tail was previously null, the newly created slideListNode has been set as the new head of the list (as well as the tail). - The tail now references the newly created slideListNode. - Throws: - IllegalArgument Exception - Thrown if newslide is null. - Note: - This insertion method does not affect the cursor, unless the list was previously empty. In that case, head, tail, and cursor should all reference the new slideListNode. - public slide removeCursor() - Brief: - Removes the slidelistNode referenced by cursor and returns the slide inside. - Preconditions: - cursor is not null. - Postconditions: - The slidelistNode referenced by cursor has been removed from the list. - All other slidelistNodes in the list exist in the same order as before. - The cursor now references the previous SlideListNode (or the head, if the cursor previously referenced the head of the list). - Returns: - The reference to the slide contained within the SlideListNode which was just removed from the list. - Throws: - EndofListexception - Thrown if cursor is null. - public static void main(string[] args) - Brief: menu options and their required information: A sample menu is provided below indicating the functionality your Slidelist program should support: F) Move cursor forward B) Move cursor backward E) Edit cursor slide P) Print presentation summary I) Insert new slide before cursor R) Remove slide at cursor H) Reset cursor to head Q) Quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions