Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How will you program using Java google.com//0//MTOSOTYXNDgxODRa sumet Northr Diet- Lab (Norking with ArrayLists) Big Bend National Park has hired you to write a program

How will you program using Java

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

google.com//0//MTOSOTYXNDgxODRa sumet Northr Diet- Lab (Norking with ArrayLists) Big Bend National Park has hired you to write a program that will allow the park rangers to monitor the visitors who come to the park each day. As visitors drive through the main gate to the park, the park rangers would like the ability to record each visitor's state, license plate number, and arrival time. When the visitors leave the park they would like to assign each visitor a departure time. The rangers would also like to be able to generate two reports. The first report should include a list of all the visitors currently in the park and the second report should nclude a list of all the visitors who visited the park for the day. They would also like the ablity to search to see if a visitor is still in the park by inputting the visitor's state and license plate number information Implementation Your implementation should include 4 classes Visitor class Park class ParkRanger class Driver class Visitor Class This class represents a visitor in the park, It's attributes include the visitor's state, license plate number, arrlval time into the park, departure time from the park, and a boolean variable which indicates whether or the visitor is still in the park. This class should also include the following behaviors . Three constructors 1. defaul a constructor which sets the state and license plate attributes from the parameter list a constructor which sets the state, license plate, and arrival time attributes from the parameter list It constructor 2. 3. Override Object class's equal method. Here is an example of an overriden equals method: ll Override equals Method public boolean equals(Object otherObject) Visitor v- (Visitor)jotherObject fllicense.equalsiv.license) && state.equals(v state)) returm true; else return false, oogle.com/u/0/c/MTQ 50TYXNDgxODRa ument internships. North else return false This equals method compares two Visitor objects by their state and license plate numbers. If they are the same t returns true, otherwise it returns false. This method is used when doing a search for a specific visitor in the park Accessor methods - need an accessor method for each instance variable. For the insidePark atribute methodisinsl Mutator methods need a mutator method for each instance variable. : Override toString method retums a String representation of al the instance variablers Park Class This class is responsible for creating and maintaining the list of park visitors (ArraytList of Visitor objects), It also needs to keep track of the current number of visitors in the park and the day's total number of visitors to the the Arraylist, current number of visitors and total number of visitors park. . Default It constructor- initializes variables . Access sor methods urrentNumVisitors returns the current number of visitors in the park tTotalNumVisitors retuns the number of visitors that have visited the park for the day o get o getVisitor - given a Visitor object, it performs a linear search on the list of visitors looking for visitor the visitor is found it returns the visitor from the list otherwise it returns null; etCurrentVisitors- this method creates and returns an ArrayList containing all of the visitors currently in the park. This is accomplished by calling the isinsidePark method each Visitor object If the method returns true then the object is added to the ArrayList to be for retumed. After the entire list of visitors has been traversed the method returns the newty created ArrayList to the calling method. getAllVisitors - this method creates and retums an ArrayList of all the visitors to the park. (This method does not return list the list of visitors maintained by the object. This list is declared private. return this list then the calling object gains the ability to modify the list. This breaks one of I rules of 0OP which states that all instance variables should only be modified gle.com/u/O/C/MTOSOTYXNDgxODRa entM Internships-Northe the fundamental rules of OOP which states that all instance variables should only be modified through the class's mutator methods.) To prevent this, you should make a copy of the original list and return it instead Mutator methods o addVisitor-given a Visitor object, this method adds the object to the ArrayList. It also updates the current number of visitors and total number of visitors attributes. o decreaseCurrentNumVisitors this method decrements the current number of visitors attribute by one Park Ranger class This class i the manager or the program,s responsible for displaying and manag g the programs mer u system and instaniating the Park object Default Constructor the constructor should instaniate the Park object and a Scanner object. It should also call the method MainMenu to start the menu system. MainMenu method-this method is responsible for displaying the main menu for the program. . VisitorArrival method this method allows the user add a visitor to the visitor database by prompting the user to enter the visitor information from the keyboard. This information includes the visitor's state license piate number, arrival time (the program should park the arrival time as a.m. or p.m.). A visitor object is created from the information provided and add to the list of visitors to the park VisitorDeparture method this method marks a visitor as departed from the park by setting the Visitor's isinsidePark attribute to false and setting its departure time SearchForVisitor method-this method allows the user to search the list for a specified visitor by providing the visitor's state and license plate Information. If the visitor is found the method should display ts current information. If the visitor is not found the method should display the message "Visitor not in park ViewCurrentVisitors This method should display a report of the current visitors in the park. The report should include a list of all visitors currently in the park including their state, license plate, and arrival time attributes, It shouid also display the total number of visitors current in the park ViewAllVisitors- This method should display a report of the total number of visitors that came to the park. The report should include a list of all visitors including their state, license plate, arrival time, and depart time attributes. It should also display the total number of visitors that visited the park for the day . This class contains the programs main methoo It Sample Run staniating a ParkRanger object Poge 2 5 a + m.google.com/u/0/c/MTOSOTYXNDgxODRa documentIntenships Northir Driver Class This class contains the programs main method. It Initlates the program by instaniating a ParkRanger obj Sample Run Main Menu 1. Visitor Arrival 2. Visitor Departure Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visitors 6. Exit Selection: 1 Visitor Arrival Enter State Abbreviation->TX Enter License Plate>SDE215 Enter Arrival Time->9:00 am 2) pm >1 Main Menu 1. Visitor Arrival Visitor Departure 3, Search for Visitor . View Current Visitors in Park Page 25a+ s Visitors classroom.google com/u/0/c/MTO5OTYXNDgXODRa Untitied document M internships-Northr Main Menu s= 1. Visitor Arrival 2. Visitor Departure 3. Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visitors 6. Exit Selection:1 Visitor Arrival Enter State Abbreviation->MS Enter License Plate MNU665 Enter Arrival Time >9:20 Main Menu Visitor Arrival 2. Visitor Departure 3. Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visitors 6. Exit Selection: 1 Visitor Arrival Enter State Abbreviation->OK nter License Plate WHQ943 >9:30 Room r x : ' Noodle X sroom.google.com/u/0/c/MTO50TYXNDgXODRa titled documentMInternships Northr Enter State Abbreviation->OK Enter License Plate -WHQ943 Enter Arrival Time >9:30 )am 2) pm 1 Main Menu 1. Visitor Arrival 2. Visitor Departure 3. Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visitors 6. Exit Selection: 2 Visitor Departure Enter State Abbreviation->TX Enter License Plate >SDE125 Enter Departure Time >2:30 1) am 2) pm ->2 Main Menu UwMzE5MDk1 Njaa classroom googie Main Menu 1. Visilor Anival 2. Visitor Departure . Search for Visilor 4. View Curent Vistors in Pak 5. View All of Today's Visilors 6. Exit Selection:2 Visitor Departure Enter State AbbreviationT Enter License Plate SDE215 Enter Departure Time-230 Main Menu 1. Visitor Arival 2. Visitor Departure 3. Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visiltors Selection: 4 Current Visitlors Report Page 4 5a+ Arrival Time TUWMZESMDKINBa RMartir >OK Enter License Plate-WHQ943 State OK License WH0943 Arrival Time = 9:30 am. Departure Time Currently inside Park true Main Menu 1. Visitor Arrival HIPPO X room.google.com/u/0//MTQSOTYANDgKODRa itled document. Internships Northr License = WHQ943 Arrival Time 9:30 a.m. Departure Time Currently inside Park true Main Menu gSS 1. Visitor Arrival 2. Visitor Departure 3. Search for Visitor 4. View Current Visitors in Park 5. View All of Today's Visitors 6. Exit Selection: 6 /C/MTUWMzESMDkINjBa

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

1. Can they separate relevant from irrelevant information?

Answered: 1 week ago

Question

Discuss the various types of data structures and their uses.

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago