Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10, Problem 6PE
Golf Scores
The Springfork Amateur Golf Club has a tournament every weekend. The club president has asked you to design two programs.
- (1) A
program that will read each player’s name and golf score as keyboard input, and then save these as records in a file named golf.dat. (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.dat file and displays them.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The Spring fork amateur golf club has a tournament every weekend. The club president has asked you to design a program. It contains the following menu:
Select the task
1. Add new records
2. Read Records
3. End the program
If the user enters 1, the program will read each players name and golf score as keyboard input, then save the records in a file names golf.dat
If the user enters 2, the program reads the records from the golf.dat file and displays them.
While the menu selection is not equal to 3, get the user selection.
If the selection is 1, get the number of players in the tournament, open the output file. For each player, get the name and the score, and write them to the file. Close the file.
If the selection is 2, open the input file, read the values from the file, display the values, close the file.
If the selection is 3, exit the program.
I already had a code written from before, but I'm having a hard time turning it into a menu driven code. It does need to have the function…
Python
Task: Loading data from files
This exercise will require you to load some information from files and use it in your program.
scene.txt contains a description of a series of shapes and colours to draw. You need to write code to read in the file data and draw the requested shapes in the correct colour. Each line in scene.txt will contain one of the following starting keywords followed by some data:
COLOUR followed by 3 values: R, G, B
CIRCLE followed by 3 values: X, Y, RADIUS
RECT Followed by 4 values: X, Y, W, H
LINE Followed by 4 values: X1, Y1, X2, Y2
CIRCLES are defined from the center. RECT's are defined from the top left. All values are space separated, and you can assume all input is correct (no errors). Please solve this program to draw the scene.
I can't upload the file scene.txt, so I decide to screenshot a file for you.
Subject: Java Programming
Chapter 10 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 10.1 - Where are files normally stored?Ch. 10.1 - What is an output file?Ch. 10.1 - What is an input file?Ch. 10.1 - What three steps must be taken by a program when...Ch. 10.1 - Prob. 10.5CPCh. 10.1 - Prob. 10.6CPCh. 10.1 - When writing a program that performs an operation...Ch. 10.1 - In most programming languages, if a file already...Ch. 10.1 - What is the purpose of opening a file?Ch. 10.1 - What is the purpose of closing a file?
Ch. 10.1 - Prob. 10.11CPCh. 10.1 - Prob. 10.12CPCh. 10.1 - What is a files read position? Initially, where is...Ch. 10.1 - In what mode do you open a file if you want to...Ch. 10.2 - Prob. 10.15CPCh. 10.2 - What is the purpose of the eof function?Ch. 10.2 - Is it acceptable for a program to attempt to read...Ch. 10.2 - Prob. 10.18CPCh. 10.2 - Which of the following loops would you use to read...Ch. 10.4 - Prob. 10.20CPCh. 10.4 - Prob. 10.21CPCh. 10.4 - Prob. 10.22CPCh. 10 - A file that data is written to is known as a(n) a....Ch. 10 - A file that data is read from is known as a(n) a....Ch. 10 - Before a file can be used by a program, it must be...Ch. 10 - When a program is finished using a file, it should...Ch. 10 - The contents of this type of file can be viewed in...Ch. 10 - This type of file contains data that has not been...Ch. 10 - When working with this type of file, you access...Ch. 10 - When working with this type of file, you can jump...Ch. 10 - This is a small holding section in memory that...Ch. 10 - Prob. 10MCCh. 10 - This is a character or set of characters that...Ch. 10 - This marks the location of the next item that will...Ch. 10 - When a file is opened in this mode, data will be...Ch. 10 - The expression NOT eof (myFi1e) is equivalent to...Ch. 10 - This is a single piece of data within a record. a....Ch. 10 - When working with a sequential access file, you...Ch. 10 - In most languages, when you open an output file...Ch. 10 - The process of opening a file is only necessary...Ch. 10 - Prob. 4TFCh. 10 - Prob. 5TFCh. 10 - When a file that already exists is opened in...Ch. 10 - In control break logic, the program performs some...Ch. 10 - Describe the three steps that must be taken when a...Ch. 10 - Why should a program close a file when its...Ch. 10 - What is a files read position? Where is the read...Ch. 10 - If an existing file is opened in append mode, what...Ch. 10 - In most languages, if a file does not exist and a...Ch. 10 - What is the purpose of the eof function that was...Ch. 10 - What is control break logic?Ch. 10 - Design a program that opens an output file with...Ch. 10 - Design a program that opens the my_name.dat file...Ch. 10 - Prob. 3AWCh. 10 - Design an algorithm that does the following: opens...Ch. 10 - Modify the algorithm that you designed in question...Ch. 10 - Write pseudocode that opens an output file with...Ch. 10 - Prob. 7AWCh. 10 - A file exists on the disk named students.dat. The...Ch. 10 - Why doesn't the following pseudocode module work...Ch. 10 - File Display Assume that a file containing a...Ch. 10 - Item Counter Assume that a file containing a...Ch. 10 - Sum of Numbers Assume that a file containing a...Ch. 10 - Average of Numbers Assume that a file containing a...Ch. 10 - Largest Number Assume that a file containing a...Ch. 10 - Golf Scores The Springfork Amateur Golf Club has a...Ch. 10 - Sales Report Brewster's Used Cars, Inc. employs...Ch. 10 - Lowest and Highest Gas Prices Assume that you have...Ch. 10 - Average Steps Taken A Personal Fitness Tracker is...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Describe the difference between an instance member variable and a static member variable.
Starting Out with C++ from Control Structures to Objects (8th Edition)
Write a function called to insert a new entry into a linked list. Have the procedure take as arguments a pointe...
Programming in C
If all the data fields in a class are private and of primitive types, and the class doesnt contain any setter m...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Write SQL queries to answer the following questions: How many students are enrolled in Section 2714 in the firs...
Modern Database Management
_____ is human-readable code that looks similar to programming language code.
Starting Out With Visual Basic (8th Edition)
Explain the difference between redundancy and diversity.
Software Engineering (10th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Using pythonarrow_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_forwardSlide Type Slide • Exercise # 4 A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: • The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), • The amount of the sale, and the date of that event. • Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exit or the format of the record is incorrect. No need to display anything else in this regard. Note that you can assume that the dates are entered correctly (no need to validate them). You may also assume that the name of the input text file is inputex4.txt. • Make sure you use a dictionary in your solution. • Sample run is included below for the given input file inputex4.txt Summary of total sales according to services Dinner 634.75 Conference 1133.25 Lodging Dinner and Lodging 550.25 625.14 Slide Tyne Fragment varrow_forward
- The File class contains file input and output operations. In other words, you can use the File class to read and write content from and to files. True Falsearrow_forwardNeed this done in C# Microsoft Visual Studio. Also please include the names of labels, textbox, button etc.. Comments and screenshots of the process are appreciated too! Thank you in the images is the question as well as the example.arrow_forwardC++ Visual Studio 2019 Write a program that asks the user for the name of a file. The program should display the contents of the file on the screen. Each line of screen output should be preceded with a line number, followed by a colon. The line numbering should start at 1. Here is an example: George Rolland 127 Academy Street 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. Note: Save text below as the file to use and name it forChap12.txt file for this assignment. The line numbers should NOT be reset for each screen. Text: No one is unaware of the name of that famous English shipowner, Cunard. In 1840 this shrewd industrialist founded a postal service between Liverpool and Halifax, featuring three wooden ships with 400-horsepower paddle wheels and a burden of 1,162 metric…arrow_forward
- Submission: Combine the code files for Q1 and Q2 as a zip file and submit in Moodle Question 1: Write a Program that to enter Student Name, Grade and print it to the screen with below requirements . . . . Asks the users how many student grades they want to enter. Based on that number the program should setup a loop to ask the user to enter student name and the student grade. Save this information using 2 arrays At the end the program must show the student names and grades with 1 student on each line on the screen Program should use Arrays and loops to achieve the task.arrow_forwardDesign an application that can be used to read DVD titles from a text file. You do not have to write to the file, only write code to read the titles of DVDs from a text file called DVD.txtarrow_forwardPython The Springhill Amateur Golf Club has a tournament every weekend. The club president has asked you to write a Menu-Driven program which has the following functionality: 1. Allows for each player's name and golf score to be entered and saved in a text file named golf.txt. 2. Reads each player's name and golf score from the text file golf.txt and provides an average score. 3. The program will use one variable for the player's name and one variable for the score.arrow_forward
- Word List File Writer: Write a program that asks the user how many words they would like to write to a file, andthen asks the user to enter that many words, one at a time. The words should be writtento a file (in python)arrow_forwardPythonarrow_forwardRandom Number File Writer 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 and should use a SaveFileDialog control to let the user specify the file’s name and location.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License