The Marietta Country Club has asked you to write a program to gather, then display the results of the golf tournament played at the end of March. The Club president Mr. Martin has asked you to write two programs.
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 a field for the first name, last name, handicap and golf score).
The second program will read the records from the golf.txt file and display them with appropriate headings above the data being displayed.
If the score is = Par, then display 'Made Par'
If the score is < Par, then display 'Under Par'
If the score is > Par, then display 'Over Par'
There are 16 players in the tournament. Par for the course is 80. The data is as follows:
Andrew Marks 11.2 72
Betty Franks 12.8 89
Connie William 14.6 92
Donny Ventura 9.9 78
Ernie Turner 10.1 81
Fred Smythe 8.1 75
Greg Tucker 7.2 72
Henry Zebulon 8.3 83
Ian Fleming 4.2 72
Jan Holden 7.7 84
Kit Possum 7.9 79
Landy Bern 10.3 93
Mona Docker 11.3 98
Kevin Niles 7.1 80
Pam Stiles 10.9 87
Russ Hunt 5.6 73

Answers

Answer 1

Answer:

Explanation:

The following program is written in Python. It creates two functions, one for writting the players and their scores to the file, and another function for reading the file and outputting whether or not they made Par. The functions can be called as many times that you want and the writeFile function allows for 16 inputs to be made when called. A test case has been provided with all of the players mentioned in the question. The output can be seen in the attached image below.

def writeFile():

   file = open('output.txt', 'w')

   for x in range(16):

       firstName = input("Enter First Name:")

       lastName = input("Enter Last Name:")

       handicap = input("Handicap:")

       score = input("Score:")

       file.write(str(firstName) + " " + str(lastName) + " " + str(handicap) + " " + str(score) + "\n")

   file.close()

def readFile():

   file = open('output.txt', 'r')

   for line in file:

       lineArray = line.split(" ")

       if int(lineArray[-1]) < 80:

           print(str(lineArray[0]) + " " + str(lineArray[1]) + " Under Par" )

       elif int(lineArray[-1]) == 80:

           print(str(lineArray[0]) + " " + str(lineArray[1]) + " Made Par")

       else:

           print(str(lineArray[0]) + " " + str(lineArray[1]) + " Over Par")

   file.close()

writeFile()

readFile()


Related Questions

Fasilitas untuk pengaturan batas kertas pada Microsoft Word adalah….

a. Margin
b. View
c. LayOut
d. Paragraph

Office 92 sering disebut juga dengan….

a. Office 3.0
b. Office 7.0
c. Office Xp
d. Office 2.0


Answers

Fasilitas untuk pengaturan batas kertas pada Microsoft Word adalah

B.View

Office 92 sering disebut juga dengan

A.Office 3.0

Write a program that asks the user to enter in a username and then examines that username to make sure it complies with the rules above. Here's a sample running of the program - note that you want to keep prompting the user until they supply you with a valid username:

Answers

user_in = input ("Please enter your username: " )

if user_in in "0123456789":

print ("Username cannot contain numbers")

elif user_in in "?":

print ("Username cannot continue special character")

else:

print (" Welcome to your ghetto, {0}! ".format(user_in))

How to use the AI System ?

Answers

ANSWER:

· New artificial intelligence systems are being developed to help teachers administer more effective testing that could uncover some of these often-hidden conditions. Once they can be properly identified, educators can tap into the resources available for a learning disability. Students can use AI to give reliable feedback.

Write a recursive function named is_decreasing that takes as its parameter a list of numbers. It should return True if the elements of the list are strictly decreasing (each element in the array is strictly less than the previous one), but return False otherwise.

Answers

Answer:

c

Explanation:

cho dãy số a[] có n phần tử và dãy số b[]cõ m phần tử là các các số nguyên dương nhỏ hơn 1000 . Gọi tập hợp A là tập các số khác nhau trong a[], tập hợp B là các số khác nhau trong b[]

Answers

Answer:

please translate

Thank you✌️

You are going to purchase (2) items from an online store.
If you spend $100 or more, you will get a 10% discount on your total purchase.
If you spend between $50 and $100, you will get a 5% discount on your total purchase.
If you spend less than $50, you will get no discount.
Givens:
Cost of First Item (in $)
Cost of Second Item (in $)
Result To Print Out:
"Your total purchase is $X." or "Your total purchase is $X, which includes your X% discount."

Answers

Answer:

Code:-

using System;

using System.Collections.Generic;

class MainClass {

public static void Main (string[] args) {

int Val1,Val2,total;

string input;

double overall;

Console.Write("Cost of First Item (in $)");

      input = Console.ReadLine();

Val1 = Convert.ToInt32(input);

Console.Write("Cost of Second Item (in $)");

      input = Console.ReadLine();

Val2 = Convert.ToInt32(input);

total=Val1+Val2;

if (total >= 100)

{

overall=.9*total;

Console.WriteLine("Your total purchase is $"+overall);

}

else if (total >= 50 & total < 100)

{

overall=.95*total;

Console.WriteLine("Your total purchase is $"+overall);

}  

else

{

Console.WriteLine("Your total purchase is $"+total);

}  

}

}

Output:

Other Questions
When was Jhon f Kennedy born how Democracy do improve the quality of decision making? How are dependent school districts different from independent school distridaOA A dependent district can use property taxes to pay for the schools,OB. An appointed school superintendent runs a dependent distriaOC. A dependent district is part of a municipal or county government.D. Students and their familles pay to attend schools in a dependent district,ResetNEG What are some hooks for a persuasive essay on Outsourcing?How do i make a hook?!? PLEASE ITS DUE IN 10 MIN!! I NEED HELP!!! Psyllium is prescribed for the client diagnosed with a cardiac disorder to facilitate defecation and prevent straining with bowel movements. The nurse reinforces instructions to the client regarding administration of the medication. Which statement by the client indicates an understanding of the use of the medication for what value of x does 4^x=(1/8)^x+5? Surface Area of conesInstructions: Find the surface area of each figure. Round your answers to the nearest tenth, if necessary. Why were women in Wyoming first to achieve suffrage? pls answer this question i think easy Cuando el pistn tiene un volumen de 2x10^-4 m^3, el gas en el pistn est a una presin de 150 kPa. El rea del pistn es 0.00133 m^2. Calcular la fuerza que el gas ejerce sobre el embolo del pistn. What are some reasons adults should read fairy tales? Reasons I've already listed:-Can encourage creativity-Can teach lifelong lessonsI need one more! A space ship has four thrusters positioned on the top and bottom, and left and right as shown below. The thrusters can be operated independently or together to help the ship navigate in all directions.Initially, the Space Probe is floating towards the East, as shown below, with a velocity, v. The pilot then turns on thruster #2.Select one:a.Space ship will have a velocity to the West and will be speeding up.b.Space ship will have a velocity to the East and will be speeding up.c.Space ship will have a velocity to the East and will be slowing down.d.Space ship will have a velocity to the West and will be slowing down.e.Ship experiences no change in motion. 6. Which is NOT a complete sentence?I smell the flowers.Tammy bought a purse today.Red and blue socks in her room.Did you eat breakfast?N Jupiter has just under 70 documented moons, .............. four largest of which are the Galilean moons Io, Callisto, Ganymede and Europa.santhe What are the advantages of Radio waves over micro waves? About how many people were killedby the atomic bomb in Nagasaki?A. 200,000B. 75,000C. 300,000 Write the fraction or mixed number as a decimal. A company like Motorola might establish a goal of reducing its inventory by 50 percent over the next year. To ensure that it reaches this goal, the company could monitor its progress on a quarterly or monthly basis. If the managers at Motorola discover that there is a danger of not achieving this goal, they can take corrective action to adjust for the deficiency. This is a description of the managers' ____ function. In RST, mR = 92 and mS = 71. Which list has the sides of RST in order from shortest to longest? Needed in 2 minutes ASAP