Question: 1 . Add this assignment to your CS 1 4 5 0 project 2 . Create a new Java class called LastNameFirstNameAssignment 2 ( in

1. Add this assignment to your CS1450 project2. Create a new Java class called LastNameFirstNameAssignment2(in Eclipse: File -> New -> Class)3. Please place all classes in one Java file. This makes the graders life and my life easier so thank you!4. Follow "CS1450 Programming Assignments Policy" 5. Write a test program (i.e. main) that:a. Opens the test file Adventures.txt for reading. b. Creates a polymorphic array to store the adventures. i. The 1st value in the file indicates how big to make the array (# of adventures). ii. Use a regular array, DO NOT use an array list. c. Fill the array with adventure objects.i. For each line in the file:1. Read the:a. Type of adventure (Zipline, Snorkel, Helicopter)b. Timec. Price for the adventure.2. Create the specific adventure objecta. Note that type indicates what kind of object to create.3. Place the adventure object into the polymorphic adventures array. d. AFTER all lines in the file have been read and all adventure objects are in the array:i. Iterate through the adventures array and for each adventure display its:1. Type, time, price, and description in a nicely formatted table.2. See output section at end of document for an example table. e. Create an AdventureCompanyi. Create an adventure company object.1. Call constructor with the specific niche set of Helicopterii. Set up the adventure company1. Use the setupCompany method in the AdventureCompany class2. Send setupCompany the polymorphic array of adventures.iii. Print the adventure company details1. Use the printCompanyDetails method in AdventureCompany class 6. Test file information:a. Run your code on the provided file Adventures.txtb. This file is an example so DO NOT assume that your code should work for only 8 adventures in the order specified in the file. 8Number of adventuresZipline 4.5210Snorkel 4.25190Zipline 5225Details for each adventureHelicopter 6420See (d) below for details aboutHelicopter 2.25350the format for these lines.Snorkel 4.5135Helicopter 4.25599Snorkel 4260 c.1st line is an integer value representing the number of adventures in the file.d. The remaining lines contain details for each adventure. The format of each line is as follows: Type Time Price Zipline 4.5210 Classes Adventure Class Descriptiono Class that represents a generic type of adventure.o Superclass in hierarchy. Private Data Fieldso type - String representing the type of adventure (zipline, snorkel, helicopter)o time double representing the number of hours the adventure takeso price double representing the cost of the adventure Public Methodso Constructor: public Adventure(String type, double time, double price) Creates an adventure by initializing instance variables type, time, and price to the incoming values for type, time, and price. o Getters One for each private instance variable - type, time, price o Setters No setters are needed (this is being done on purpose so do not include setters) o public String description() Returns a string that describes the adventure. Use some generic string at this level, the specific strings are in subclasses. Zipline, Snorkel, Helicopter Subclasses Descriptiono Each class represents a specific adventure.o Each class must be a subclass of Adventure. Private Data Fieldso None Public Methodso Each subclass must have a constructor that: Creates a specific Adventure with a specific type, time, and price. Note that type is NOT sent to the constructor - time and price are the only two incoming values as shown here: public Zipline(double time, double price){...} Why is type not sent to constructor? Inside each specific constructor the type of adventure is known, so there is no need to send the constructor the type. For example, in the Zipline constructor, we know the type of adventure being created is a Zipline adventure so the type Zipline does not need to be passed into the constructor, instead the string Zipline can be sent to the superclass constructor along with the time and price. o Each subclass must override the description() method in the Adventure class. @Overridepublic String description() Use the following descriptions for each specific adventure: Adventure TypeDescriptionZiplinePut on a harness, connect to a cable, enjoy an aerial viewSnorkelUse a diving mask & breathing tube, enjoy underwater worldHelicopterWatch the world unfold from a bird's eye view AdventureCompany Descriptiono Class that represents an adventure company that specializes in only 1 specific adventure. Private Data Fieldso niche String representing the one specific adventure this company specializes ino availableAdventures array of adventures in specific niche that are available from this company Public Methodso Constructor: public AdventureCompany(String niche) Creates an adventure company that specializes in a specific niche. Initializes instance variable niche to incoming niche. o Getters/Setters None o public void setupCompany (Adventure[] adventures) The adventure company specializes in 1 specific adventure which is stored in the instance variable niche when the company is created. This method 1st determines how many adventures in the incoming array match the companys specific niche. Next, the method creates and fills the adventure companys array (availableAdventures) with adventures in the incoming array that match the adventure companys niche. o public void printCompanyDetails() Displays these details for the AdventureCompany: Niche the company specializes in Number of adventures it provides Type, time, and price of each adventure it provides

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!