
Concept explainers
Write Java code
Objectives
•Use an abstract data type for a list
•Use a method that contains an Object type as a formal parameter
•Use methods in an existing class
•Access data members within a class
Required Files:
•ListInterface.java
•ListException.java
•ListOutOfBoundsException.java
•ListArrayBased.java
Description A list is an abstract data type used to store ordered data, and contains operations that fall into the following categories: (1) add data to a data collection, (2) remove data from a data collection, and (3) ask questions about data in a data collection. The operations which ask questions about the data in a data collection may include operations that determine if a data collection is empty, determine the size of a data collection, and retrieve the item at a given position in a data collection. A list should be able to contain any type of object. The methods for the List support any object as specified in the interface. In this assignment, the objects will be S trings.
class ListDriver
•The purpose of the ListDriver class is to perform ADT list operations on a list of objects of type String.
•The data that is to be used for the list is located in an array that is hard coded into the main method, which should include the name of each the grocery item from the example used in our discussion on the ADT: List. •An instance of ListArrayBased is passed to various methods within the ListDriver class along with other arguments needed for the method to perform its task. Appropriate comments are included for each method. •You will add code to the various methods in the ListDriver class so that each one performs its task as specified.
part 3 of the code in the pictures
* position pos. */
public void removeItem(ListArrayBased list, int pos){
TO DO: add code here
}
/* * removeAllItems *
* Precondition: a reference to a list *
* Postcondition: all items currently stored in the list * are removed */
public void removeAllItems(ListArrayBased list){
// TO DO: add code here
}
} // end of class ListArrayBasedDriver
![Postconditions:
* "List empty: B" where B is either TRUE or FALSE
* and "Size of list: n" where n is the size of
* the list is written to std out.
public void displaystatus(ListarrayBased list)
{
// TO DO: add code here
}
* displaylist
* Precondition: a reference to a list
*
* Postcondition: list is displayed on std out
*/
public void displaylist(ListarrayBased list)
{
// TO DO: add code here
* buildlist
* Precondition: a reference to a list and an string array
* of items to be address to the list
* Postcondition: items stored the string array are added
* to the list.
* /
public void buildlist(ListarrayBased list, string[] items)
{
// TO DO: add code here
}
* addItem
*
* Precondition: a reference to a list, a string
* representing a grocery item, and the integer
pos is the position in the list
*
* Postcondition: an item is added to the list at
* position pos.
* /
public void addItem(ListarrayBased list, string item, int pos)
{
// TO DO: add code here
}
то
* removeItem
*
* Precondition: a reference to a list and
* int pos;
* Postcondition: item is removed from the list by its](https://content.bartleby.com/qna-images/question/f27854cd-5d9f-4553-a6c0-a306ccf4a4ef/ca54251e-7868-419c-a6e0-073dad35a691/h1cbuag_thumbnail.png)
![//package PA02
/*
File: Listoriver.java
* ASsignment: Programming Assignment 2
Author:
Date:
Course:
Instructor:
Purpose: Test an implementation of an array-based list ADT.
To demonstrate the use of "ListArrayBased" the project driver
* class will populate the list, then invoke various operations
* of "ListarrayBased".
*/
import java.util.scanner;
public class Listoriver {
* main
*
* An array based list is populated with data that is stored
* in a string array. User input is retrieved from that std in.
* A text based menu is displayed that contains a number of options.
* The user is prompted to choose one of the available options:
* (1) Build List, (2) Add item, (3) Remove item, (4) Remove all items,
* or (5) done.
* appropriate method based on the option chosen by the user, and
* prompts the user for further input as required Program terminates
* if user chooses option (5). If the user chooses an option that is
* not in the menu, a message telling the user to choose an appropriate
* option is written to std out, followed by the options menu.
The switch statement manages calling the
*/
public static void main(string[] args)
{
String[] dataItems =
{"milk", "eggs", "butter", "apples", "bread", "chicken"};
// TO DO: add code here
} // end of main method
/*
* Displays the options menu, including the prompt
* for the user
*/
public void displayMenu()
{
// TODO: add code here
}
* displaystatus
* displays information about the state of
* the list
*
* Preconditions: a reference to a list](https://content.bartleby.com/qna-images/question/f27854cd-5d9f-4553-a6c0-a306ccf4a4ef/ca54251e-7868-419c-a6e0-073dad35a691/t3q4f3g_thumbnail.png)

Step by stepSolved in 2 steps

- IN java YOUR TASK IS TO IMPLEMENT A JAVA APPLICATION WHICH WILL FUNCTION AS A TYPE OF STUDENT REGISTRATION DATABASE WHICH WILL ENABLE AN ADMINISTRATIVE USER TO EITHER CREATE OR DELETE A STUDENT ACCOUNT IN THE DATABASE IN ORDER TO STORE THE FOLLOWING DETAILS:- (1)THE STUDENT’S NAME, (4) THE STUDENT’S ID NUMBER, (3) A LIST OF THE COURSES WHICH THE STUDENT HAS TAKEN ALONG WITH THE CORRESPONDING GRADES FOR THESE COURSES. NOTE: WHEN THE VALUE -1 IS ENTERED, THE APPLICATION WILL TERMINATE. please check the attached imagearrow_forward{JAVA data structure set} Suppose you have a list of numbers: numbers = [1, 2, 13, 4, 4, 5, 5, 6, 6, 7, 7, 12] Convert this list into a set and assign it to a new variable called unique_numbers. Print unique_numbers to see the result.arrow_forward// FILE: DPQueue.h// CLASS PROVIDED: p_queue (priority queue ADT)//// TYPEDEFS and MEMBER CONSTANTS for the p_queue class:// typedef _____ value_type// p_queue::value_type is the data type of the items in// the p_queue. It may be any of the C++ built-in types// (int, char, etc.), or a class with a default constructor, a// copy constructor, an assignment operator, and a less-than// operator forming a strict weak ordering.//// typedef _____ size_type// p_queue::size_type is the data type considered best-suited// for any variable meant for counting and sizing (as well as// array-indexing) purposes; e.g.: it is the data type for a// variable representing how many items are in the p_queue.// It is also the data type of the priority associated with// each item in the p_queue//// static const size_type DEFAULT_CAPACITY = _____// p_queue::DEFAULT_CAPACITY is the default initial capacity of a// p_queue that is created by the default…arrow_forward
- use replit please Thank youarrow_forwardPointers and references are fully equivalent True Falsearrow_forwardEvery data structure that we use in computer science has its weaknesses and strengthsHaving a full understanding of each will help make us better programmers!For this experiment, let's work with STL vectors and STL dequesFull requirements descriptions are found in the source code file Part 1Work with inserting elements at the front of a vector and a deque (30%) Part 2Work with inserting elements at the back of a vector and a deque (30%) Part 3Work with inserting elements in the middle, and removing elements from, a vector and a deque (40%) Please make sure to put your code specifically where it is asked for, and no where elseDo not modify any of the code you already see in the template file This C++ source code file is required to complete this problemarrow_forward
- C++ Data Structure:Create an AVL Tree C++ class that works similarly to std::map, but does NOT use std::map. In the PRIVATE section, any members or methods may be modified in any way. Standard pointers or unique pointers may be used.** MUST use given Template below: #ifndef avltree_h#define avltree_h #include <memory> template <typename Key, typename Value=Key> class AVL_Tree { public: classNode { private: Key k; Value v; int bf; //balace factor std::unique_ptr<Node> left_, right_; Node(const Key& key) : k(key), bf(0) {} Node(const Key& key, const Value& value) : k(key), v(value), bf(0) {} public: Node *left() { return left_.get(); } Node *right() { return right_.get(); } const Key& key() const { return k; } const Value& value() const { return v; } const int balance_factor() const {…arrow_forwardAttention>>>>>>>>> project should written in C languages In the project, a student affairs information system simulation is requested to be made using structures (“struct”), linked lists (“linked list”) and files (“file”). According to this; a) Create a structure called a course. The members of this structure are code, name, instructor, term (can take Spring or Fall values), year, and a course pointer. Functions with prototype void insertCourse(CourseNodePtr* cr, CourseNodePtr* inscr, char* code), char* deleteCourse(CourseNodePtr* cr, CourseNodePtr* inscr, char* code) that will operate on course data structure elements, since the courses taken by the students are to be kept with a linked list. write. While writing the insertCourse() function, prevent the same student from taking the same course more than once. b) Create a structure called student. Let the members of this structure be id, name, surname, department, class (can take B.Sc., M.Sc., Ph.D.),…arrow_forwardWould it be possible to use unique, shared or weak pointers in the code?arrow_forward
- C++arrow_forwarddictionaries = [] dictionaries.append({"First":"Bob", "Last":"Jones"}) dictionaries.append({"First":"Harpreet", "Last":"Kaur"}) dictionaries.append({"First":"Mohamad", "Last":"Argani"}) for i in range(0, len(dictionaries)): print(dictionaries[i]['First']) ************************************************* please modity the above code to "Add an ‘if’ statement(s) to the loop in your solution in Exercise 7 to only show the full name if the first name is “Bob” or if the last name is “Kaur”.arrow_forwardDue in C languagearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





