Line Numbers
(This assignment could be done as a modification of the program in
1:George Rolland
2:127 Academy Street
3:Brasstown, NC 28706
If the file’s contents won’t fit on a single screen, the program should display 24 lines of output at a time, and then pause. Each time the program pauses, it should wait for the user to strike a key before the next 24 lines are displayed.
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Additional Engineering Textbook Solutions
C++ How to Program (10th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (4th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Database Concepts (7th Edition)
Modern Database Management (12th Edition)
- 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_forwardLine Numbers Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. Pythonarrow_forwardIn C# create an application that writes a series of random numbers to a file. Each random number should be in the range of 1 through 100. The application should let the user specify how many random numbers the file will hold.arrow_forward
- C++ Create a program that reads a file containing a list of songs and prints the songs to the screen one at a time. After each song is printed, except for the last song, the program asks the user to press enter for more. After the last song, the program should say that this was the last song and quit. If there were no songs in the file to begin with, the program should say that there are no songs to show and quit. The program should begin by asking the user for the name of the input file. Each song consists of a title, artist, and year. In the file, each song is given on three consecutive lines. Create this program using a class Song.arrow_forwardA 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_forwardInstructions The 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 a field for the player's score.) allow for any number of players and scores to be input. 2. a program that reads the records from the golf.txt file and displays them. Be sure to use clear prompts/labeling for input and output.arrow_forward
- A Personal Fitness Tracker is a wearable device that tracks your physical activity, calories burned, heart rate, sleeping patterns, and so on. One common physical activity that most of these devices track is the number of steps you take each day. The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day. (The first line is the number of steps taken on January 1st, the second line is the number of steps taken on January 2nd, and so forth.) Write a program that reads the file, then displays the average number of steps taken for each month. (The data is from a year that was not a leap year, so February has 28 days.) You don't need to see the file , Just write a code using the "file" like this def main(): with open("steps.txt", "r") as file:arrow_forwardPython - Next Birthdate In this task, we will write a program that reads birthdate data from a given CSV file, and given the current date, determines which person's birthday will be celebrated next. Create a function with the following signature: nextBirthdate(filename, date) filename: parameter, which represents the CSV filename. date: parameter, which represents the current date. The function should open the CSV file, read the birthdate data, and determine which person's birthday will be celebrated next, given the current date. The name of the person should be returned. In other words, given a date, find the person whose birthday is next. Sample Run birthdates.csv Draven Brock, 01/21/1952 Easton Mclean, 09/02/1954 Destiny Pacheco, 10/10/1958 Ariella Wood, 12/20/1961 Keely Sanders, 08/03/1985 Bryan Sloan,04/06/1986 Shannon Brewer, 05/11/1986 Julianne Farrell,01/29/2000 Makhi Weeks, 03/20/2000 Lucian Fields, 08/02/2018 Function Call nextBirthdate("birthdates.csv", "01/01/2022") Output…arrow_forwardPROGRAM NEEDS TO MATCH EXAMPLE PHOTO Write a program ( lab6.cpp ) that gives and takes advice on program writing. The program starts by writing a piece of advice to the screen and asking the user to type in a different piece of advice. The program then ends. The next person to run the program receives the advice given by the person who last ran the program. The advice is kept in a file, and the contents of the file change after each run of the program. You can use your editor to enter the initial piece of advice in the file so that the first person who runs the program receives some advice. Allow the user to type in advice of any length so that it can be any number of lines long. The user is told to end his or her advice by pressing the Return key two times. Your program can then test to see that it has reached the end of the input by checking to see when it reads two consecutive occurrences of the character ‘\n’. Hints:- You need to look at each character as it is read to see if it is…arrow_forward
- GirlNames.txt This file contains a list of the 200 most popular names given to girls born in the United States from the year 2000 through 2009. BoyNames.txt This file contains a list of the 200 most popular names given to boys born in the United States from the year 2000 through 2009. Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy’s name, a girl’s name, or both, and the application will display messages indicating whether the names were among the most popular. **programming language is python** ** must use a def main(): function** *please include some comments* i aslo have the .txt files but no wya to upload themarrow_forwardJava languagearrow_forwardC programming language Criteria graded: Declare file pointers Open file Read from file Write to file Close file Instructions: Write a segment of code that opens a file called “numbers.txt” for reading. This file is known to have 10 numbers in it. Read in each number and print a ‘*’ to the screen if the number is even. If the number is odd, do nothing. Conclude by closing this file.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT