Order ID:89JHGSJE83839 | Style:APA/MLA/Harvard/Chicago | Pages:5-10 |
Instructions:
Classes and Objects in Python Project
For this assessment, you will be demonstrating the use of classes and objects in Python.
You will write a simple golf scoring program that defines a golf class from which you will create three objects (one for each hole on a three-hole golf course). You will pass the hole number, score, and par value for each object. The class will contain a method that evaluates a score and displays whether the score is at, under, or over par for the given hole.
Instructions—Part 3
Define your golf class.
Use the keyword “class” to define a class named golf
Initialize a class variable named results to hold the string that states whether the score is at, under, or over par.
Hint: Initialize with a space.
Define the constructor method to accept variables for hole, score, and par. Initialize hole and par.
Hint: Use self as an argument like self.hole = hole
Define a method to evaluate and display the score. Use an IF statement to check the score against par. Set the results accordingly. Display the results for the given score and par value. Include the par value in the display.
score > par is “Over Par”
score < par is “Under Par”
Otherwise (equal) is “At Par”
Reference: Refer to Programming in Python, Chapter 10: Classes and Objects / 10.1 Designing Classes.
Initialize a score variable to zero.
Create your objects for each hole. There should be three arguments: the hole number, the score, and the par value.
Example:
hole1=Golf(1, score, 3)
Where 1 represents the hole number, score will be the user’s score entered, and 3 is the par value for the given hole.
Reference: Refer to Programming in Python, Chapter 10: Classes and Objects / 10.2 Creating Objects.
Prompt the user to enter a hole number and score. Store the hole number in a variable and the score in the score variable initialized previously.
Hint: Placing int ahead of the input statement will store the user input as a number.
Reference: Refer back to your readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 3: Built-In Functions / Getting Input From the User.
Use IF statements to evaluate the hole number entered and call the appropriate class method for the appropriate hole object. This will invoke the method in the class to display the results to the user.
Example:
if enterHole == 1:
hole1.evaluateAndDisplayScore(enterHole, score)
Reference: Refer to Programming in Python, Chapter 10: Classes and Objects / 10.3 Accessing Attributes.
EXAMPLE RESULTS
Enter the hole number: 1
Enter your score: 5
You scored Over Par on hole # 1 with a par of 3
Enter the hole number: 2
Enter your score: 1
You scored Under Par on hole # 2 with a par of 4
Enter the hole number: 3
Enter your score: 5
You scored At Par on hole # 3 with a par of 5
RUBRIC |
||||||
Excellent Quality 95-100%
|
Introduction
45-41 points The background and significance of the problem and a clear statement of the research purpose is provided. The search history is mentioned. |
Literature Support 91-84 points The background and significance of the problem and a clear statement of the research purpose is provided. The search history is mentioned. |
Methodology 58-53 points Content is well-organized with headings for each slide and bulleted lists to group related material as needed. Use of font, color, graphics, effects, etc. to enhance readability and presentation content is excellent. Length requirements of 10 slides/pages or less is met. |
|||
Average Score 50-85% |
40-38 points More depth/detail for the background and significance is needed, or the research detail is not clear. No search history information is provided. |
83-76 points Review of relevant theoretical literature is evident, but there is little integration of studies into concepts related to problem. Review is partially focused and organized. Supporting and opposing research are included. Summary of information presented is included. Conclusion may not contain a biblical integration. |
52-49 points Content is somewhat organized, but no structure is apparent. The use of font, color, graphics, effects, etc. is occasionally detracting to the presentation content. Length requirements may not be met. |
|||
Poor Quality 0-45% |
37-1 points The background and/or significance are missing. No search history information is provided. |
75-1 points Review of relevant theoretical literature is evident, but there is no integration of studies into concepts related to problem. Review is partially focused and organized. Supporting and opposing research are not included in the summary of information presented. Conclusion does not contain a biblical integration. |
48-1 points There is no clear or logical organizational structure. No logical sequence is apparent. The use of font, color, graphics, effects etc. is often detracting to the presentation content. Length requirements may not be met |
|||
You Can Also Place the Order at www.collegepaper.us/orders/ordernow or www.crucialessay.com/orders/ordernow
Classes and Objects in Python Project |
Classes and Objects in Python Project