Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python python Bird Watchers of America want an app that will help them keep track of bird counts. They need a program that will allow
python
python
Bird Watchers of America want an app that will help them keep track of bird counts. They need a program that will allow them to enter how many of each bird is sighted, store the data, and display the data. I suggest the following functions: o O o createData: This function writes name and count data to the file specified by the parameter. 1. Requires 1 parameter: file name. 2. Opens the file for writing. 3. Asks a bird's name. 4. Start while loop: (as long as the name entered is not stop) Gets the bird's count. An integer. o Writes the bird's name to the file defined by the parameter. Writes the bird's count to the file defined by the parameter. Counts how many records were written to the file. Gets a bird's name. (Ask user to enter stop as the name when there are no more birds to enter.) 5. Closes the file. 6. Returns the record count. readData: This function reads the file, prints the contents, and returns the count 1. Requires 1 parameter: file name. 2. Opens the file for reading. 3. Reads 1* record as the bird type. 4. Starts while loop: (As long as the type is not *") o Reads in the bird's count. o Prints the name and count on the same line with a tab between them. o Keeps track of how many types and how many birds. o Reads next record as the bird type. 5. Returns the total number of birds sighted and the number of bird types. main(): 1. 2 3. 4 5. Asks whether the user wants to create a file or read the file. Make sure no other options are accepted. (Validation loop) Asks for the file name. Calls the appropriate function based on the option entered. If the option was to write, prints "You wrote x records to the file. If the option was to read, prints "There were x types of birds and y total birds." Don't forget comments and name at the top and comments for each function Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started