2/4/2021Assignment: Object Oriented Programming (Initial Submission) 2/4/2021Assignment: Object Oriented Programming (Initial Submission) Assignment: Object Oriented Programming (Initial Submission)...

1 answer below »
File attached


2/4/2021Assignment: Object Oriented Programming (Initial Submission) 2/4/2021Assignment: Object Oriented Programming (Initial Submission) Assignment: Object Oriented Programming (Initial Submission) Assignment Instructions This assignment will use a file (bdata.txt ) containing one record for each bike station (669 stations) but the the complete data set has 176 million records. Each bike station record contains multiple pieces of data about the time, bike station, number of docks at the station, the number of bikes at the station, the status to of the station and where the station is located.{ "id": "515", "timestamp": "2020-11-16T11:55:55.000", "station_name": "Paulina St & Howard St", "total_docks": "19", "docks_in_service": "19", "available_docks": "9", "available_bikes": "10", "percent_full": "53", "status": "In Service", "latitude": "42.019159", "longitude": "-87.673573", "location": { "type": "Point", "coordinates": [-87.673573, 42.019159] } , "record": "51520201116115555" } The data is stored as name value pairs as shown below (NOTE: the actual file has all of the data for one bike station on a single line). Step 1: Write an BikeStation class that demonstrates the following aspects of OOP in Python: 1. Create a basic class that can hold all relevant Bike data for an individual bike station (see above). As with a database, you don't normally want to have calculated values stored in your objects because it could cause data integrity issues if, for example - you update the available_bikes when a bike is returned but forget to update percent_full. As such, you BikeStation class should only include the data values to uniquely specify the current state (number bikes available, number slots in the station). 2. Appropriately create a constructor to set all data values . 3. Use the @property decorator to make at least one property in your BikeStation class private. 4. Use the @???.setter method to validate the private property in some way (e.g. check if its numeric, change it's data type, change it's length) before setting its value. 5. Create one or more regular class methods to CALCULATE other relevant bike station values from the data attributes you are storing as a part of the class. 6. Override the __str__ method to print a string representation of a BikeStation that looks like the String below (note that the format of the date string is different than it is in the data file): Paulina St & Howard St had 10 bikes on Mon Nov 16 11:55:55 2020 Step 2: Write a second class called Point, Position or Time to store one or more pieces of BikeStation data. The class could store latitude & longitude OR timestamp You should use this class in the BikeStation class instead of storing the vales as primitive data types You may use the Author and Article classes presented in lecture as a starting point for these classes. Step 3: Testing you classes using data from the data file bdata.txt 1. Prompt for a file name (bdata.txt ): 2. Open that file and read through the file 3. Display a custom error message if the file does not exist 4. Use an appropriate String method find lines for the BikeStations you were assigned - e.g. lines that contain: "id": "###" (where (###) is the number for one of the Bike Stations you were assigned). 5. Once you have found lines of, you can pull the BikeStation data out from the the line by splitting the line on a ", " and then splitting the string a second time using a colon. 6. Create a new BikeStation object and add them to a list. 7. Print the BikeStation Object 8. You code should be efficient (you should not have to open the file multiple times NOR should you have to loop through the data more than once). 9. Print out the total number of Bikes available for each of the five Bike Stations you were are gathering data for after the file has been completely read. 10. Print out the total number of empty bike docks available for each of the five Bike Stations you were are gathering data for after the file has been completely read. Your output should look something like this: Paulina St & Howard St had 10 bikes on Mon Nov 16 11:55:55 2020 Clark St & Jarvis Ave had 1 bikes on Mon Nov 16 11:55:55 2020 Greenview Ave & Jarvis Ave had 3 bikes on Mon Nov 16 11:55:55 2020 Bosworth Ave & Howard St had 1 bikes on Mon Nov 16 11:55:55 2020 Eastlake Ter & Rogers Ave had 2 bikes on Mon Nov 16 11:55:55 2020 Stations: [515, 517, 520, 522, 523] Bikes Available 17 Docks Available 58 https://ucdenver.instructure.com/courses/456908/assignments/9775961/4 https://ucdenver.instructure.com/courses/456908/assignments/9775961/4
Answered 3 days AfterFeb 05, 2021

Answer To: 2/4/2021Assignment: Object Oriented Programming (Initial Submission) 2/4/2021Assignment: Object...

Neha answered on Feb 07 2021
144 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here