Concept explainers
Given the scores . txt file described in
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Absolute C++
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Management Information Systems: Managing The Digital Firm (16th Edition)
SURVEY OF OPERATING SYSTEMS
Java: An Introduction to Problem Solving and Programming (8th Edition)
Degarmo's Materials And Processes In Manufacturing
- A MyPetStore sells many pets and their accessories. As new pets are added to the MyPetStore, theirinformation is entered into a flat text file. Each month, the manager requests a listing of all pets sorted bytheir price. You must write a program to produce a report of MyPetStore and their types sorted by their pricesfrom the data in the flat text file. Below is a description of the information on the text file:• The first entry is the number of animals on the file (numeric) •The fields below repeat for each animal:o Pet name (String)o Birthdate (java.time.LocalDate)o Price (numeric)o Species Type (String)o Special feature (boolean or String)The animals sold by the MyPetStore are of six types: Dogs & Cats, Reptiles, Birds, Rabbits & SmallAnimals.For Dogs & Cats, the special feature field on the flat file is the breed of the animal (String).For Reptiles, the special feature field is the blood type (warm vs cold-blooded, String).For Birds, the special feature field is the…arrow_forwardThe Clay Hill Golf Club has a tournament every weekend. the club president ask you to write two programs: 1. a program that will read each player's name and golf score as keyboard input, then save those records in a file named golf.txt. (each record will have a field for the player name and five rounds of golf scores for each golfer.) allow for any number of players to be input. 2. a program that reads the records from the golf.txt file and averages the scores, calculates the golfer's handicaparrow_forwardC programming create a text base game to race 4 cars across the screen and determine the first second and third place. A text file (car.txt) with the name of the driver, type of the race car, car number, and the color of the car is given to you. In addition to the above, the user(s) should be asked if they want to modify their car’s specs. Such as the type of race car (Ford, Chevy, Dodge, etc.), the car number, name of driver, and the color. The user should be able to make changes to their vehicle between each race. The modifications are to be saved to a file. With each key press a random number between 0 and 10 is generated to represent the cars next distance to travel.arrow_forward
- Finish this program from the code posted below! Note: There should be two files Main.py and Contact.py You will implement the edit_contact function. In the function, do the following: Ask the user to enter the name of the contact they want to edit. If the contact exists, in a loop, give them the following choices Remove one of the phone numbers from that Contact. Add a phone number to that Contact. Change that Contact's email address. Change that Contact's name (if they do this, you will have to remove the key/value pair from the dictionary and re-add it, since the key is the contact’s name. Use the dictionary's pop method for this!) Stop editing the Contact Once the user is finished making changes to the Contact, the function should return. Code:from Contact import Contactimport pickledef load_contacts():""" Unpickle the data on mydata.dat and save it to a dictionaryReturn an empty dictionary if the file doesn't exist """try:with open("mydata.dat", 'rb') as file:return…arrow_forwardCreate a file in your project named employees.txt with the following data (you can simply create the file by hand rather than with Python code): 123 Bob Smith345 Anne Jones256 Carol Lee845 Steve Robert Anderson132 Jill Thompson From your program's main function, give the user the following options: lookup a name based on ID number, lookup an ID number based on name, and quit the program. OPTION 1: The user chooses to lookup a name based on ID number: Use a try/except and ask the user to enter an integer. If they don't enter an integer, print an error message. If they do enter an integer, call a function named lookup_employee which takes the id as a parameter. If an employee with the given id number is found, return the name. Otherwise, return the string “Employee not found” Back in main, print the return result. OPTION 2: The user chooses to lookup an ID based on name: Ask the user to enter the first and last name (don't ask for the middle name). Call a function named…arrow_forwardIn C++, my program reads from a file, each line of the text file ends in a 1 or 0. How do you make a function that updates the value in the text file to change to from 1 to 0 or 0 to 1?arrow_forward
- PLEASE COMMENT CODE In a python program, create a new file and call it “ tracking”. Write to it four lines each contains information about an order like this: 1-00654-021 Dell charger Toronto-WEST 99-49-ZAD011-76540-022 ASUS battery Milton-EAST 34-56-CBH561-09239-026 HP HD Scarborough-NORTH 12-98-AZC451-12349-029 Mac FD North York-LAWRENCE 34-49-ZWL01Add the file two more lines: 1-34567-055 Lenovo SSD Milton-ON 34-09-MT04 1-90432-091 Lenovo battery Oakville-ON 78-KL98 Define a function that searches for a brand (e.g. Dell, ASUS, etc.). Test the function in your program.arrow_forwardThe manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets—box, sideline, premium, and general admission. After each game, data is stored in a file in the following form: ticketPrice numberOfTicketsSold … Sample data are shown below: 250.75 5750 100.50 28000 50.25 35750 25.00 18750 The first value indicates that the ticket price is Php 250.75 and that 5750 tickets were sold at that price. Output the total number of tickets sold and the total sale amount using c++ compiler. Format your output with two decimal places.arrow_forwardThe Springfork Amateur Golf Club has a tournament every weekend. The club president hasasked you to write two programs:1. A program that will read each player’s name and golf score as keyboard input, then savethese as records in a file named golf.txt. (Each record will have a field for the player’sname and a field for the player’s score.)2. A program that reads the records from the golf.txt file and displays them.arrow_forward
- C++ Language Order Processing Order E 46 H 76 D 2 G 7arrow_forwardPlease write the code in carrow_forwardIn Python Write a program that consists of (at least) two function: A function that creates and saves data in a file. The saved data represents exam grades. In the function, you will create n random numbers in the range [0,100], where n is the number of students. The function can be called as follows: createFile(filename, n) Main function, in which the user inputs the file name and the number of students, then the main calls function createFile. The main should perform validation for n (should be > 0), and the filename (should end with .txt). I will explain how to validate strings in the coming lecture. Hint: a good developer will write four functions to solve the problem.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning