Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hallo! I have a quation about java language! Write a program that reads a file containing name (see class list) and puts all names in

Hallo!

I have a quation about java language!

Write a program that reads a file containing name (see class list) and puts all names in an ArrayList called Class List. Reading file is easiest with java's Scanner scan = new Scanner (new file ("filename")). Make sure the file is in the same folder as the application. If you are using Eclipse or another development environment, check where to add the text file. Print the list so you know that the program works. Type a method public static boolean addToList (ArrayList list, String name) that argues an ArrayList object list that contains a list of names in alphabetical order and a name. The method should investigate if the name is in the list. If not already, the name should be added to the list in the correct location (ie the list must remain sorted) and the method should return the true. If the name already exists, the method returns false. Tip! Use the comparTo () method of the String class to find the correct index in the list. Complete the program you have written before calling it the addToList method a few times, both with existing names and with names that are not available. How can you prove that the program is working properly?

Here is class name!

Mattias Alm Andreas Andersson Amanda Andersson John Aronsson Percy Bolmer Carl Erik Bong Nilsson Jonas Claesson Robin Egbo Emilio Essen Tobias Frick Jan Frick Elena Genova Gustav Hellqvist Love Hjorth Andre Jansson Timmie Jensen Christopher Johansson Marcus Johansson Daniel Karlsson Jolina Kollander Noresson Sabo Krcic Bata Malesev Elias Nilsson Sjstrm Rasmus Norgren Philip Plsson Robin Rosengren Jem Salltun Christofer Schoerner Martin Sjolin Andreas Sjstrm Rikard Svensson Matilda Svensson Simone Svensson Filip Thomasson Julia Tranberg Michael Wendt Elric Zand

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

ISBN: 0764532545, 978-0764532542

More Books

Students also viewed these Databases questions