Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

playerData2.txt Anthony 2416 Caleb 73 Christian 94 Daniel 3968 Elijah 3553 Gabriel 1870 James 2700 Jaylen 1440 Jordan 3583 Joshua 2388 Justin 3170 Malik 1946

image text in transcribed

image text in transcribed

playerData2.txt

Anthony 2416 Caleb 73 Christian 94 Daniel 3968 Elijah 3553 Gabriel 1870 James 2700 Jaylen 1440 Jordan 3583 Joshua 2388 Justin 3170 Malik 1946 Michael 1754 Tyler 92 Xavier 2584 Aaliyah 452 Alexis 2312 Angel 979 Brianna 2752 Destiny 4991 Gabrielle 2992 Hannah 4830 Isis 3258 Jasmine 4391 Jordan 2720 Kennedy 1760 Laila 4636 Makayla 535 Sydney 4348 Tiana 4347 Dalila 3372 Marlie 1577 Irene 1476 Demetra 2485 Gaynor 2460 Birgit 2387 Aubine 2344 Noel 490 Sarah 1920 Patrica 1541 Karee 1842 Cacilie 3847 Eimile 4974 Kaila 4823 Ileana 800 Olive 2903 Arlina 3427 Verile 1752 Eirena 1517 Lindie 1774 George 702 Cindie 1977 Persis 4611 Buffy 226 Priscilla 3276 Micheline 3032 Trudie 4256 Libbie 4090 Hermina 3559 Millicent 376 Candide 3442 Darline 2159 Clarine 859 Hetty 3205 Dorelia 15 Rosamund 2039 Doralia 4551 Dorisa 1085 Stephine 477 Conni 4696 Lucila 3028 Rubie 3594 Felicle 1075 Zola 265 Ilene 3005 Mildred 4972 Cinnamon 874 Mercy 4044 Bernardine 443 Carie 852

Arrays, Methods and File Processing This lab requires you to write methods to read and manipulate data that is stored in a text file. It is designed to give you more hands on practice with arrays and methods before Classes and Objects are reintroduced. You will also read and write data to a file using exception handling (try/catch block). try t //perform some operation that could cause an exception catch ( SOME EXCEPTION TYPE exception { /Actions to perform if there is an exception Use your programming IDE to create a new project. Name your project PlayerStats. In the main method, declare and instantiate two arrays of size 80. One array to hold the player's name (names) and another array to hold the player's integer high game (scores). These arrays are considered parallel because corresponding elements in the arrays refer to the same player. For example, the high score in scores 15] belongs to the player in names[15]. So, if you ever move a player name to another location in the names array (for example, during sorting), you must also move the score to the same location in the scores array to keep them synchronized. names Before After Kia Adam Caleb Caleb Before After 568 239 450 568 50 39 Kia For each of the following problems, you should modify the main method to invoke the method and show output that proves that your method is working correctly 1. Write a method that will read player names and high scores from the input file into the parallel arrays. The parameters for the method are the two arrays and the input file name (String). The method has a void return type. For this problem, set a breakpoint on the method call and then issue a step-over debugger command. After the step-over command, click on the "Variables tag and inspect the names and scores arrays to see if they contain the expected 80 values. Write a method that will output the parallelarrays to the console. Your output should have two columns: Player Name and High Score. Research the String.format() method in order to get your output in aligned columns. 2

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions