DataReader.java: A class that reads data from the sample data files. You will need to modify this class to create Book and Author objects, associate them and then return a filled Book[] array. This array is used in the Catalogue class. You have to extract the Author data from the lines yourself where the "/“ delimiter separates multiple author names.
Q: String[] testArray3 - {"the", "quick", "broun", "fox", "Jumped", "over", "lazy", "dog"};…
A: 1) Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent…
Q: Write a program which: • creates a new Array List • adds 5 decimal numbers to it • prints the list…
A: Index of a list starts from 0 Thus, for odd index, we can say remainder has to be 1
Q: Determine if the following statement are true or false Screen shot shows the text's arraycollection…
A: Step 1:- Given Information:- When comparing two objects using the == operator, what is actually…
Q: Java Programming Class Car Attributes (all private): vin: String (5 digits) make: String model:…
A: public class Car { private String vin; private String make; private String model;…
Q: 2- The purpose of the method resize() in the IntegerArray class below is to dynamically change the…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: Write a program that deletes the first element in an array which matches a search key.
A: As no programming language is mentioned, it is solved using basic C++
Q: FilelO 04: Echo to ArrayList Write a FileIo04 class with a method named readFileToArrayList() that…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: Using the code given as a reference. In the main file personalInfo.java create an ArrayList of…
A: So as per statement so it does not require you to get user input using a scanner, you can just…
Q: 09 randArray Part 4 DESCRIPTION Get a value from the user and using a loop, search for the value in…
A: Program to compare the entered integer by the user with the array elements and print the index…
Q: List> list = new ArrayList(countWords.entrySet()); list.sort((one, another) -> -…
A: List<Map.Entry<String, Integer>> list = new ArrayList<>(countWords.entrySet());…
Q: ****************************Instructions***************************** Add a "copy constructor" to…
A: Objective: Here, a copy constructor requires to be added and some courses would be added to the…
Q: Class Gradebook2D The class Gradebook2D will produce the same output of the class Gradebook1D, but…
A: Program: //import the header file import java.util.Scanner; import java.text.DecimalFormat;…
Q: A copy constructor. Overloaded == operator: This will return true if arrays in two different…
A: #include <iostream>#include <stdio.h> #include <stdlib.h> using namespace std;…
Q: When you create a class and want to include the capability to compare its objects so they can use…
A: be careful not to override the existing lcomparable.CompareTo() method User always have to override…
Q: Snames1:snames names ArrayList<String :String :String :String Ayesha Jazan Bushra Jazan Zahra Jazan…
A: Answer of the Following Questions are below:
Q: What are the most significant distinctions between an array and a collection?
A: The answer is given below:-
Q: FilelO 04: Echo to ArrayList Write a FileI004 class with a method named readFileToArrayList() that…
A: The try-catch block is the error-handling block of code to handle the run time exception or errors…
Q: True or False? Instantiating an array of objects reserves room to store references only.
A: Give True/ False Statement Instantiating an array of objects reserves room to store references…
Q: Doctor signature:String doctorID:int medicine:Arraylist Doctor(signature:String,doctorID:int)…
A: This UML is implemented in java using object-oriented programming. Since there is no language…
Q: Create SoftDrink objects and store them in an ArrayList (see the Appendix) as each softdrink is…
A: Program Explanation: Import the required classes from the ‘java.util’ package Define the class…
Q: Write a program that will Sort an elements to an ArrayList or LinkList.
A: Sample Response: //Java program to sort the elements of an ArrayListimport java.util.*; public class…
Q: Create class IntegerSet. Each IntegerSet object can hold integers 0 though n, where n can be…
A: Actually, array is a collection of elements.
Q: import java.util.ArrayList; /** * A class to hold details of audio files. * * @author David J.…
A: Answer: Here is the completed code for this method. Copy and paste this into your MusicOrganizer…
Q: Answer in Java. you have an array called inventory with 5 max values constructor looks like: public…
A: Answer: I have done code and also I have attached code and code screenshot as well as output
Q: constructor to create the books object ok bookobj): to add a new book to the arrayli
A: The program code provided below is made up of two files Library.java and Book.java. Library.java has…
Q: 1- The FloatArray class stores a dynamic array of floats and its size. It has: - A parameterized…
A: An array is a collection of variables that are the same data type. An array is collection of similar…
Q: Create an object called GSSArray. (It stands for growable self-sorting array) This object will…
A: Program: //GSSArray.java import java.util.*; class GSSArray { private int array[]; private…
Q: Computer Science Part 2: Client Program with ArrayList Create a second client program. This program…
A: Program: import java.util.ArrayList;import java.util.Random;import java.util.Scanner; class…
Q: can't get the program read countrydata.txt file
A: The entire program looks too good and when you are loading a file using Scanner, you need to be…
Q: Create a program that 1. Initializes a game object. 2. Reads a file of signs and stores each sign…
A: Program explanation: Include the header file. Create an object with String data type. Reads the…
Q: A teacher has five students who have taken four tests. The teacher uses the following grading scale…
A: #include <iostream> using namespace std; int main(){ string names[5];char…
Q: Complete the following problem using concepts of Key index searching,sorting and hashing
A: import java.util.*; class GFG { public static void main(String args[]) {…
Q: myMusic MusicOrganizor ArrayListString ftes String Stang Sting "MorningBlues.mp3 "DontGo.mp3…
A:
Q: flipObject(object) Given an object, you will return a new object where the values are now the keys…
A: Lets see the solution.
Q: vWhat happens when an object such as an array is no longer referenced by a variable?
A: ARRAY - An array is an collection of elements that is referenced by their index. Variable - A…
Q: A(n) __________ is an object that can hold a group of values that are all of the same data type. a.…
A: Arrays In programming languages like C/C++, C#, or Java, the array is commonly used data structure…
Q: Please answer in c++. Create a template class UniversalArray which createss an array of a given…
A: Does the template class work in C++In C++, a template is a blueprint or formula for creating a…
Q: Recipe Program - Java ONLY I am looking to create a program that is a recipe holder. It needs to…
A: package recipe; import java.util.ArrayList; public class Recipe { public String title;…
Q: Create a class name Array with attributes array itself, value to add and value to remove, with…
A: Python code :- list=[]class Array: def add(self,value): list.append(value)…
Q: ReadInstructor. The class will: – Create an array of instructor objects – Read the…
A: The java program is given below: - Explanation: - Importing the essential packages. Defining the…
Q: 4. A double pointer of type char called preposition. This is a 2D dynamic array that contains words…
A: Find the sentence construction below.
Q: Java - When using an array to do a binary search, what additional requirement is placed on the…
A: Binary Search: It's a searching algorithm for finding an element position in the given list of…
Q: /** * creates an array of 1000 integers where each element matches its index * * @return the array…
A: The function creates an array of size 1000. The loop runs 1000 times to fill the values of array.…
Q: flipObject(object) Given an object, you will return a new object where the values are now the keys…
A: Ans:) In this javascript program, we have to flip the objects with key-value pairs and if the value…
Q: Parameters array - Any JavaScript Array size - A positive integer Number indicating the desired…
A: We are given a Javascript code. As per the requirement, we have to group the array elements into…
Q: Doctor -signature:String -doctorID:int - medicine:Arraylist +Doctor(signature:String,doctorID:int)…
A: This UML is implemented in java using object oriented programming. Since there is no language…
Can someone assist in with answering this question please?
Step by step
Solved in 2 steps
- In Java import java.util.Scanner; public class ShoppingList { public static void main (String[] args) { Scanner scnr = new Scanner(System.in); ItemNode headNode; // Create intNode objects ItemNode currNode; ItemNode lastNode; String item; int i; // Front of nodes list headNode = new ItemNode(); lastNode = headNode; int input = scnr.nextInt(); for(i = 0; i < input; i++ ){ item = scnr.next(); currNode = new ItemNode(item); lastNode.insertAtEnd(headNode, currNode); lastNode = currNode; } // Print linked list currNode = headNode.getNext(); while (currNode != null) { currNode.printNodeData(); currNode = currNode.getNext(); } } } ----------------------------------------- public class ItemNode { private String item; private ItemNode nextNodeRef; // Reference to the next node public ItemNode() { item = ""; nextNodeRef = null; } // Constructor public ItemNode(String itemInit) { this.item = itemInit; this.nextNodeRef = null; } // Constructor public…using Java, create a virtual shopping store. using the two txt files (items and sale), display a list of items, price and if on sale. have the user select what items they want until they press 'q' to quit. show list of what they purchased, add the total and how much they saved. class BillProcessor {public static void prepareBill(LinkedHashMap<String, Integer> purchases, LinkedHashMap<String,Double>items, LinkedHashMap<String,String> sales, ArrayList<String> itemNames) {total cost = 0total discount = 0for each item in purchases:compute the regular costif item is subject to a sale (i.e. it appears in the sales lhm)determine the sales price if it's bogo - mod operator and the int/intif it's not bogo - apply the discount pricecompute the actual cost based on thattotal cost = total cost + actual costtotal disc = total disc + discountprint a line formatted like the example that summarizes the purchase of that itemprint the summary}} public class KlumpGroceryStore…import java.util.Scanner; public class LabProgram { public static Roster getInput(){ /* Reads course title, creates a roster object with the input title. Note that */ /* the course title might have spaces as in "COP 3804" (i.e. use nextLine) */ /* reads input student information one by one, creates a student object */ /* with each input student and adds the student object to the roster object */ /* the input is formatted as in the sample input and is terminated with a "q" */ /* returns the created roster */ /* Type your code here */ } public static void main(String[] args) { Roster course = getInput(); course.display(); course.dislayScores(); }} public class Student { String id; int score; public Student(String id, int score) { /* Student Employee */ /* Type your code here */ } public String getID() { /* returns student's id */…
- import java.util.Scanner; public class Playlist { // TODO: Write method to ouptut list of songs public static void main (String[] args) { Scanner scnr = new Scanner(System.in); SongNode headNode; SongNode currNode; SongNode lastNode; String songTitle; int songLength; String songArtist; // Front of nodes list headNode = new SongNode(); lastNode = headNode; // Read user input until -1 entered songTitle = scnr.nextLine(); while (!songTitle.equals("-1")) { songLength = scnr.nextInt(); scnr.nextLine(); songArtist = scnr.nextLine(); currNode = new SongNode(songTitle, songLength, songArtist); lastNode.insertAfter(currNode); lastNode = currNode; songTitle = scnr.nextLine(); } // Print linked list…import java.util.Scanner; public class StateInfo { /* Your code goes here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String stateCode; String stateName; stateCode = scnr.next(); stateName = scnr.next(); printStateInfo(stateCode, stateName); }}import java.util.Scanner; public class DebugSix3 { public static final int TIME_WASTER = 500; public static void main(String[] args) throws InterruptedException { Scanner input = new Scanner(System.in); System.out.print("Enter a number between 1 and 20 >> "); int num = input.nextInt(); if (num < 1 || num > 20) { System.out.println("Number out of range!"); return; } for (int i = num; i > 0; i--) { System.out.print(i + " "); Thread.sleep(TIME_WASTER); } System.out.println("Blastoff!"); } } The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. An example of the program is shown below: Enter a number between 1 and 20 >> 5 5 4 3 2 1 Blastoff! Depending on the value assigned to the…
- Java Program ASAP Here is a FileSorting program to read a CSV file, sorts a list of integers on each row, and prints a comma separated list of sorted integers on the console. Modify ir by removing or changing the main method os it passes all the test cases. import java.io.File;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner; public class FileSorting { private static final String FILENAME = "somefile.txt"; public static void main(String[] args) { // read integers from input file Scanner fileReader; ArrayList<Integer> numbers = new ArrayList<>(); try { fileReader = new Scanner(new File(FILENAME)); while(fileReader.hasNextLine()) { numbers.add(Integer.parseInt(fileReader.nextLine().trim())); } fileReader.close(); }catch(FileNotFoundException fnfe){ System.out.println("File " + FILENAME + " is not…import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle); myCourse.printInfo(); myOfferedCourse.setCourseNumber(oCourseNumber); myOfferedCourse.setCourseTitle(oCourseTitle); myOfferedCourse.setInstructorName(instructorName); myOfferedCourse.setLocation(location); myOfferedCourse.setClassTime(classTime);…import java.util.Scanner; public class Inventory { public static void main (String[] args) { Scanner scnr = new Scanner(System.in); InventoryNode headNode; InventoryNode currNode; InventoryNode lastNode; String item; int numberOfItems; int i; // Front of nodes list headNode = new InventoryNode(); lastNode = headNode; int input = scnr.nextInt(); for(i = 0; i < input; i++ ) { item = scnr.next(); numberOfItems = scnr.nextInt(); currNode = new InventoryNode(item, numberOfItems); currNode.insertAtFront(headNode, currNode); lastNode = currNode; } // Print linked list currNode = headNode.getNext(); while (currNode != null) { currNode.printNodeData(); currNode…
- import java.io.File;import java.io.FileReader;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner; public class Client{Scanner sc = new Scanner(System.in);ArrayList <Student> students = new ArrayList<Student>();ArrayList <Student> courses = new ArrayList<Student>();// Method to read the file contents and stores it in// instance arraysvoid readStudents(){// Scanner class object declaredScanner readStuF = null;// try block beginstry{// Opens the file for readingreadStuF = new Scanner(new File("student.txt"));// Loops till end of the file to read recordswhile(readStuF.hasNextLine()){ String stu = readStuF.nextLine();String []eachStu = stu.split(" ");students.add(new Student(eachStu[0], eachStu[1],eachStu[2], Long.parseLong(eachStu[3]),Integer.parseInt(eachStu[4]), Integer.parseInt(eachStu[5]),Integer.parseInt(eachStu[6])));}// End of while loop }// End of try block// Catch block to handle file not found…Write a Java program that incorporates a loop that prompts the user for student data. Student data are private fields in a student class including: String name String address double GPA Each student object is stored in a linked list. After the user completes the data entry, output the contents of the linked list in ascending sorted order by name to a regular text file that can be opened and viewed using a simple plain-text editor such as notepad. Validate numeric data for Grade Point Average (GPA).import java.util.Scanner; public class ParkingFinder {/* Your code goes here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numVisits; int duration; numVisits = scnr.nextInt(); duration = scnr.nextInt(); System.out.println(findParkingPrice(numVisits, duration)); }}