in java the last two pictures are the .txt files
Assignment Description This assignment provides more practice creating and manipulating classes as well as the opportunity to use Java's Comparable interface. For this assignment, create a program that simulates a Pinball Machine. Here are some terms related to pinball and their meaning for this assignment. See the document Pinball Targets.docx for a visual. Playing Field The flat surface of the game on which targets are arranged. The ball rolls along this surface hitting the targets giving the player points. Target The targets we will use are bumpers, kickers, rollovers, and flippers. When the ball comes in contact with a bumper, kicker, or rollover points are added to the overall score. Hit When the ball comes in contact with a target. The pinball machine will contain a playing field of targets. The size of the playing field, is specified in the Pinball Machine Targets.txt file. To setup the pinball machine's playing field, read the number of rows and number of columns from the file and create a Pinball Machine object that contains a playing field (2D array) based on these values. Next, for each target in the file, read its details, create the target, and place the target into playing field at its specified row and column. Note, not all locations in the pinball machine's playing field will contain a target. For example, in the test file shown below, in row 0 columns 0, 1, 3 and 4 are empty, in row 1 columns 0, 2, and 4 are empty, rows 2-6 also contain empty columns After all targets are placed into the pinball machine's playing field, display the pinball machine, play a game, and print a report. In the report, targets must be displayed in order from the one with the most hits to the lowest hits. See output below, Specifications 1. Create a Java class called LastNameFirstName Assignment 2. Follow "CS1450 Programming Assignments Policy" 3. Write a test program (i.e. main) to do the following Step 1: Create a pinball machine object Contains a playing field (2D array) with the number of rows & columns read from file. Step 2: Load pinball machine with all targets in file For each target in the file: Read details for the target from the file. o Create a target obiect using the details, Step 2: Load pinball machine with all targets in file For each target in the file: o Read details for the target from the file. o Create a target object using the details. o Add target to pinball machine's playing field in row & column specified in file o Use the addTarget ToPlayingField method in the Pinball Machine class Step 3: Display the loaded pinball machine. Display a nicely formatted version of the pinball machine's playing field Use display Playing Field() method in Pinball Machine class (see 1' output example) Step 4: Play a game. Write a method to play a game: public static void play(Pinball Machine pinball Machine) throws IOException This method must: Be placed in your Assignment4 class Play.txt file simulates one game. This file provides different locations of the ball on playing field during the game. See #4 below for file details. For each location in the file, determine if a target was hit. o This means: if there is a target in the location, then a hit occurred. o When a target is hit, increment target's hits, update the score with points from this target, then print the target's type, id, points, and the current score at that point in game (see 2 output example) Step 5: Print a report for the pinball machine. Write a method to print the report: public static void printReport (Pinball Machine pinball Machine) This method must: Be placed in your Assignment4 class Create one TargetReport for each target and This method must: Be placed in your Assignment4 class Create one TargetReport for each target and place all reports into an ArrayList Sort all TargetReports in ArrayList using the Collections.sort() method Print all Target Reports in ArrayList (which are now sorted by number of hits) o Use the print() method on TargetReport (see 3 output example) 4. Test file information (PinballMachine Targets.txt and Play.txt) a. Setup the pinball machine using the file Pinball Machine Targets.txt This file is an example so DO NOT assume that your code should only work for a playing field with 7 rows and 5 columns and/or these targets in this specific order. The grader file will be different. of rows in playing field (array row index) of columns in playing field (array column index) 02 Bumper 1 100 1 1 Bumper 2 100 1 3 Bumper 3 100 Details for each target 20 Kicker 1 10 22 Rollover 1 10 24 Kicker 2 10 3 1 Rollover 2 50 Note 33 Rollover 3 50 - Row 0: columns 0, 1, 3, 4, are empty 42 Rollover 4 10 - Row 1: columns 0, 2, 4 are empty SO Rollover 5 50 - Row 2: columns 1 & 3 are empty 51 Flipper 10 - Row 3: columns 0, 2, 4 are empty 5 3 Flipper 20 - Row 4: columns 0, 1, 3, 4 are empty 54 Rollover 6 50 - Row 5: columns 2 is empty - Row 6: all columns are empty i. 1. line is the number of rows in the pinball machine's playing field ii. 2 line is the number of columns in the pinball machine's playing field iii. Remaining lines contain details for each target. The peso ii. 2 line is the number of columns in the pinball machine's playing field iii. Remaining lines contain details for each target. The format is as follows: Row# Column# Type: Id Points 0 1 Bumper 1 100 b. Simulate playing a game (a ball rolling around) using the Play.txt file. This file is an example so DO NOT assume that your code should only work for the rows and columns specified in the file or the rows and columns in this specific order. The grader file will be different. Row# Column 0 4 Classes Remember, build as much of the classes as possible before you start writing the code in main. Pinball Machine Class Description o Represents the pinball machine. o Pinball machine contains one playing field that is modeled by a 2-dimensional array . In the test file, the playing field has 7 rows (0-6) and 5 columns (0-4). Calum Row ... Ren! - Row 2 Kicker Row 3 Calm I Column 2 Column 3 Column 4 Bamper -... Bumper - Humpor Rew Rollover Rollover Rollover Flipper - Flipper Rollover Rew 5 Rollover Private Data Fields o number Rows -number of rows in the playing field (i.e. row index) numberColumns - number of columns in the playing field (i.e. column index) o playing Field - array of Target objects (HAS-A relationship) use a 2D array NOT ArrayList see FAQ for help with 2D arrays see FAQ for help with 2D arrays Public Methods o Constructor: public Pinball Machine (int numberRows, int numberColumns) Initializes numberRows and numberColumns to incoming values . Initializes size of playing field (2D array) to numberRows and numberColumns playingField = new Target[numberRows(numberColumns); o Getters: For data fields numberRows and numberColumns o Setters: None o add Target To Playing Field (introw, int column, Target farget) - Places incoming target object in 2D array at a specified location (row/column) o getTarget (introw, int column) Returns the target stored in the playing field (2D array) at specific row/column If no target in row/column location (i.e. empty array location), returns null o display Playing Field Displays nicely formatted version of pinball machine's playing field (2D array) Print row #, column #, and target type (see 1 example output below) Target Class Description o Represents one target Private Data Fields o type-string value for the target's type (bumper. kicker, rollover, flipper) oid - integer value for the targets unique id o points - integer value for the # of points this target is worth when it is hit by the ball o hits - integer value for the number of times this target is hit during play Public Methods o Constructor public Target (String type, int id, int points) initializes all private data fields with incoming Public Methods o Constructor public Target (String type, int id, int points) . initializes all private data fields with incoming values o Getter: One for each private data field o Setters: None o increment Hits) Updates the value stored in hits by one TargetReport Class Description o Represents the report for one target. o Class must implement Comparable