Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class OneliayNoRepeatslist public static int START_POSITION 1; public static int DEFAULT_SIZE = 50; private int countotEntries; //can be less than entry.length. private String[] entry:

image text in transcribed
image text in transcribed
image text in transcribed
public class OneliayNoRepeatslist public static int START_POSITION 1; public static int DEFAULT_SIZE = 50; private int countotEntries; //can be less than entry.length. private String[] entry: 7 + * Creates an empty Hist with a given capacity. public OnewayNoRepeatsList(int maximuwumberOfEntries) entry new String[maximumkumber Of Entries); countOfEntries e; public Oneway Nokepeatstise() entry = new String(DEFAULT SIZE): countOfEntries = "; or replace these the statements with this CEFALT SITE) 1 public boolean isFull) return countOfEntries se entry.length; > public boolean isEmpty) return countotries we .) Precondition at the full + Postconds tem was hot on the itu been added to the last public void additem(string item) 11 (lisonlist)) 11 (countorentzentry length) System out.println("Attert to add to full list Systet.exit(); le anticourtofintries] = TEM norint sen: I Normal 1 No Spac.. Paragraph otherwise, null is returned. / public String getEntryAt(int position) String result = null; 11 ((i > Found=true; else 1 > return found > public int getMaxinununberofEntries() return entry.length public int geterorenties) sont les 2 u vodi rointi Pal import java.util.Scanner; public class ListDemo [ public static final int MAX SIZE - 3; //Assumed > 0 public static void main(String[] args) OneWayNoRepeatslist toDoList - new OneWayNoRepeatslist(MAX_SIZE); System.out.println( "Enter items for the list, when prompted."); boolean moreEntries - true: String next = null; Scanner keyboard - new Scanner(System.in); while (moreEntries & ItoDoList.isFull) { System.out.printin("Enter an item: "); next- keyboard.nextLine(): toDoList.addItem(next): if (toDoList.isFullo) System.out.println("List is now full."); } else { System.out.print("More items for the list?): String ans keyboard.nextLine: ** (ans.trino.equalsignorecase("no")) moreEntries falses says no more System.out.println(The list contains:") in position toolist. START_POSITION: next + tobotist.getEntryAt{position); (next le null null indicates end of list System.out.printintnext); DOS 10 Toolist.getEntryAt(position): public class OneliayNoRepeatslist public static int START_POSITION 1; public static int DEFAULT_SIZE = 50; private int countotEntries; //can be less than entry.length. private String[] entry: 7 + * Creates an empty Hist with a given capacity. public OnewayNoRepeatsList(int maximuwumberOfEntries) entry new String[maximumkumber Of Entries); countOfEntries e; public Oneway Nokepeatstise() entry = new String(DEFAULT SIZE): countOfEntries = "; or replace these the statements with this CEFALT SITE) 1 public boolean isFull) return countOfEntries se entry.length; > public boolean isEmpty) return countotries we .) Precondition at the full + Postconds tem was hot on the itu been added to the last public void additem(string item) 11 (lisonlist)) 11 (countorentzentry length) System out.println("Attert to add to full list Systet.exit(); le anticourtofintries] = TEM norint sen: I Normal 1 No Spac.. Paragraph otherwise, null is returned. / public String getEntryAt(int position) String result = null; 11 ((i > Found=true; else 1 > return found > public int getMaxinununberofEntries() return entry.length public int geterorenties) sont les 2 u vodi rointi Pal import java.util.Scanner; public class ListDemo [ public static final int MAX SIZE - 3; //Assumed > 0 public static void main(String[] args) OneWayNoRepeatslist toDoList - new OneWayNoRepeatslist(MAX_SIZE); System.out.println( "Enter items for the list, when prompted."); boolean moreEntries - true: String next = null; Scanner keyboard - new Scanner(System.in); while (moreEntries & ItoDoList.isFull) { System.out.printin("Enter an item: "); next- keyboard.nextLine(): toDoList.addItem(next): if (toDoList.isFullo) System.out.println("List is now full."); } else { System.out.print("More items for the list?): String ans keyboard.nextLine: ** (ans.trino.equalsignorecase("no")) moreEntries falses says no more System.out.println(The list contains:") in position toolist. START_POSITION: next + tobotist.getEntryAt{position); (next le null null indicates end of list System.out.printintnext); DOS 10 Toolist.getEntryAt(position)

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions