Question

CHAPTER 6 Question 10 (Programming Exercises) The Springfork Amateur Golf Club has a tournament every weekend....

CHAPTER 6 Question 10 (Programming Exercises) The Springfork Amateur Golf Club has a tournament every weekend. The club president has asked you to write two programs. 1. A program that will read each player’s name and golf score as keyboard input, then save these as records in a file name golf.txt (Each record will have a field for the player’s name and a field for the player’s score.) 2. A program that reads the records from the golf.txt file and displays them

0 0
Add a comment Improve this question Transcribed image text
Answer #1

you can use python

1st program

def main(): move_on = 'y' golfScoreFile = open('golfRecords.txt','a') while move_on == 'y' or move_on == 'Y': pName = input("Enter the player's name: ") pScore = int(input("Enter the player's score: ")) golfScoreFile.write(pName + "\n") golfScoreFile.write(str(pScore) + "\n") move_on = input("Would you like to continue? [y]: ") displayRecords = input("Would you like to display all the records from golfRecords.txt? [y]: ") golfScoreFile.close() if(displayRecords == 'y' or displayRecords == 'Y'): displayRecs()

2nd program

def displayRecs(): golfScoreFile = open('golfRecords.txt','r') lineCount = 1 for line in golfScoreFile: golfRecLine = lineCount % 2 if(golfRecLine == 0): print("The score of this person is: ",line) if(golfRecLine == 1): print("The name of this person is: ",line) lineCount = lineCount + 1 golfScoreFile.close() # call main main()

if you have any problem , let me know

Add a comment
Know the answer?
Add Answer to:
CHAPTER 6 Question 10 (Programming Exercises) The Springfork Amateur Golf Club has a tournament every weekend....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The Springfork Amateur Golf Club has a tournament every weekend. The club president has asked you...

    The Springfork Amateur Golf Club has a tournament every weekend. The club president has asked you to write a program that will read each player's name and score as keyboard input, and then save these as records in a file named golf.txt. First, have the program ask the user how many players they want to add to their record. Then, ask the user for each name and score individually. golf.txt should be structured so that there is a line with...

  • The the results or the golf tournament played at the end of March. The Club president...

    The the results or the golf tournament played at the end of March. The Club president Mr. Martin has asked you to write two programs. Country Club has asked you to write a program to gather, then display The first program will input each player's first name, last name, handicap and golf score and then save these records in a file named golf.txt (each record will have field for the first name, last name, handicap and golf score). The second...

  • PLEASE UPLOAD or Write a simple pesudo code and java code for this program with comments...

    PLEASE UPLOAD or Write a simple pesudo code and java code for this program with comments in both describe what things do. Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing them to a file called "golf.dat" Entering "Z" for the player...

  • PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS...

    PLEASE UPLOAD or Write a simple PSEUDO CODE AND JAVA CODE for this program WITH COMMENTS IN BOTH TELLING WHAT EACH PART DOES. (I NEED BOTH CODES NOT JUST ONE OR THE OTHER) Problem Statement A golf club has a small tournament consisting of five golfers every weekend. The club president has asked you to design a program that does the following: Reads player’s names and their scores from the keyboard for each of the five golfers and simulates writing...

  • (C++) The CSIT Racing Club is a group that runs amateur car racing events throughout the...

    (C++) The CSIT Racing Club is a group that runs amateur car racing events throughout the US. In This project, write a program that will help the club determine the winner of their Fall Rally Race. You will need to determine each racer’s average time and identify the first place finisher. An input file with race information contains records of all the laps run by each driver. The record for each driver includes the number of the car the driver...

  • Review the structure type address_t described in Programming Project 5 of Chapter 10. Write a program...

    Review the structure type address_t described in Programming Project 5 of Chapter 10. Write a program that will create a binary file of address_t structures by repeatedly prompting the user to enter the IP(internet protocol) address and nickname and writing the address_t structure to the binary file. Create a second program that reads each address_t structure from the binary file and displays it in a readable format on the screen.//////////Here is problem 5 but the part in bold is what...

  • I've done all questions except question 6. how do I do this? please help. code needs...

    I've done all questions except question 6. how do I do this? please help. code needs to be java 1. You need to be able to open and read the text files that have been provided for the project. Write a Java program that reads the driver.txt file and displays each data value for each line from the file to the screen in the following format: Licence Number: Licence Class: First Name: Last Name: Address: Suburb: Postcode: Demerit Points: Licence...

  • Overview These exercises will allow you to have some practice with basic Java file Input/Output. In...

    Overview These exercises will allow you to have some practice with basic Java file Input/Output. In addition, you will also have an opportunity to have more practice with methods and arrays.   Objectives Practice with programming fundamentals Variables - Declaration and Assignment Primitive types Arithmetic Expressions Simple keyboard input and text display output Branching - if-elseif-else syntax Loops - simple while loops, nested while loops Methods - functions and procedures ArrayLists - collections of variables File I/O Works towards the following...

  • Files, Pointers and Dynamic Memory Allocation, and Structs Due date/time: Tuesday, Nov 26th, 11:00 PM. WRITE...

    Files, Pointers and Dynamic Memory Allocation, and Structs Due date/time: Tuesday, Nov 26th, 11:00 PM. WRITE A C++ PROGRAM (USE DYNAMIC MEMORY ALLOCATION) THAT READS N CUSTOMER RECORDS FROM A TEXT FILE (CUSTOMERS.TXT) SUCH THAT THE NUMBER OF THE RECORDS IS STORED ON THE FIRST LINE IN THE FILE. EACH RECORD HAS 4 FIELDS (PIECES OF INFORMATION) AND STORED IN THE FILE AS SHOWN BELOW: Account Number (integer) Customer full name (string) Customer email (string) Account Balance (double) The program...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT