Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
C How to Program (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Programming in C
Starting Out with Python (4th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Starting Out With Visual Basic (7th Edition)
- I'm trying to write a Java program that stores a text file of integer values into a 2D array. The integers in each column are separated by commas. I also want to print out the 2D array after it is created this is the text file: Input.text 15, 50, 62, 72, 73, 74 58, 60, 70, 73, 76, 82 43, 59, 65, 72, 82, 65 18, 42, 63, 69, 73, 85arrow_forward1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or byentering the string “quit”. 2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For example, if the list contains the following names: Charles Darwin Albert Einstein Issac Newton Tony Hoare Grace Hopper Edgar Dijkstra Ada Lovelace Charles Babbage Stephen Hawking Your program should output:The first name in the list in alphabetical order is: Ada Lovelace The last name in the list in alphabetical order is: Tony Hoarearrow_forwardJava In this assignment, you will practice using an ArrayList. Your class will support a sample program that demonstrates some of the kinds of operations a windowing system must perform. Instead of windows, you will be manipulating “tiles.” A tile consists of a position (specified by the upper-left corner x and y), a width, a height, and color. Positions and distances are specified in terms of pixels, with the upper-left corner being (0, 0) and the x and y coordinate increasing as you move left and down, respectively. You won’t have to understand a lot about tiles and coordinates. That code has been written for you. You are writing a small part of the overall system that keeps track of the list of tiles. You are required to implement this using an ArrayList. The only method you need to use from the Tile class is the following: // returns true if the given (x, y) point falls inside this tile public boolean inside(int x, int y) Your class is to be called TileList and must…arrow_forward
- I need to create a java program without using any java tools, just the java scanner.arrow_forwardWrite a program that uses an object of type ServiceRequests to keep track of customers that have called. It should have a loop that, in each iteration, attempts to add a name, remove a name, or print all names. Use an array of size 10 as the list of names.arrow_forwardWrite a Java Program that allows the user to enter an arbitrary number of integer grades from the keyboard. Each grade should be added to an ArrayList called grades. Stop inputting grades when -1 is entered. The program should then iterate through the ArrayList, calculate the average grade, and output it along with the minimum and the maximum grade value.arrow_forward
- In Java: The CSV (or comma-separated values) format is commonly used for tabular data. Each table row is a line, with columns separated by commas. Items may be enclosed in quotation marks, and they must be if they contain commas or quotation marks. Quotation marks inside quoted fields are doubled. Here is a line with four fields:1729, San Francisco, "Hello, World", "He asked: ""Quo vadis?""" Implement a class CSVReader that reads a CSV file, and provide methodsint numberOfRows()int numberOfFields(int row)String field(int row, int column)arrow_forwardWrite this program in Java using a custom method. Implementation details You will implement this program in a specific way in order to gain some experience with loops, arrays and array lists. Use an array of strings to store the 4 strings listed in the description. Use a do-while loop for your 'game engine'. This means the game starts once the user enters money. The decision to stop occurs at the bottom of the loop. The do-while loop keeps going until the user quits, or there is no money left. The pseudocode for this 'game engine' is shown below: determine the fruits to display (step 3 below) and print them determine if there are 3 or 4 of the same image display the results update the customer balance as necessary prompt to play or quit continue loop if customer wants to play and there's money for another game. Use the Random class to generate a random number between 0 and 3. This random number will be an index into the array of strings. Add the string at that index to an…arrow_forwardWrite a Java application CountryList. In the main method, do the following:1. Create an array list of Strings called countries.2. Add "Canada", "India", "Mexico", "Peru" in that order.3. Use the enhanced for loop to print all countries in the array list, one per line.4. Add "Spain" at index 15. Replace the element at index 2 with "Vietnam". You must use the set method.6. Replace the next to the last element with "Brazil". You must use the set method. You willlose one point if you use 3 in the set method. Do this in a manner that would replace thenext to the last element, no matter the size of the array list.7. Remove the object "Canada" Do not remove at an index. Your code should work if"Canada" was at a different location. There is a version of remove method that willremove a specific object.8. Get and print the first element followed by "***"9. Call method toString() on countries to print all elements on one line.10. Use the enhanced for loop to print all countries in the array list,…arrow_forward
- Computer Science In java, use while (!StdIn.isEmpty()) to read in a file of strings with 3 letter words. put these strings into an array and choose one word from the array at random. Ask the user to guess the string. If they get it wrong, give them one of the letters, then let them guess again. Keep going until they get the correct answer. then output "Good job, you guessed my word!"arrow_forwardUsing Java You will write the code to perform the following operations using the ArrayList class: Implement a Shoe class, encapsulating the concept of a shoe A shoe has a color, size, and brand. Implement a ShoeStore class, encapsulating the concept of a shoe store. Use the ArrrayList of Shoe objects. Fill the ArrayList object with Shoe objects. Implement a ShoeSearchEnginge class Print Shoe objects in the ArrayList. color: white size: 11 brand: Anne Klein color: yellow size: 13 brand: Calvin Klein color: black size: 9 brand: COACH color: blue size: 5 brand: CLARK color: black size: 7 brand: Cole Han color: blue size: 15 brand: FitFlo color: red size: 9 brand: CLARK Find all Shoe objects with CLARK as a brand in the ArrayList. Find the largest size of a Shoe object in the ArrayList.arrow_forwardUsing the code given as a reference. In the main file personalInfo.java create an ArrayList of person type named infolist. Add 3 person objects, 3 teacher objects and 3 student objects to the ArrayList, then navigate the ArrayList using a loop to print out the info on all 9 people. You can modify the program so it does not require you to get user input using a scanner, you can just create all of the people by passing in the information as parameters: add.infolist(new person(tom , jones , 732-555-5555 , 20 Church Lane );Make sure you pass the correct parameters for the object you are creating in the correct order.Given code:personalInfo.java // driver classimport java.util.*;public class personalInfo { static Scanner sc = new Scanner(System.in); // main method public static void main(String[] args) { //printing the menu System.out.println("Press 1. if you are person"); System.out.println("Press 2. if you are teacher"); System.out.println("Press 3.…arrow_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