Question
When creating the folder and file names for your programs, please use the this naming convention: first_last _baseball_ch XX .py where first_last specifies your first
When creating the folder and file names for your programs, please use the this naming convention: first_last_baseball_chXX.py where first_last specifies your first and last name and chXX specifies the chapter number, as in ch05. For programs that have multiple files, store the files in a folder named first_last_baseball_chXX.
When creating names for variables and functions be creative. Your variables show allow people to know what it's purpose is.
Top-down development
Always start by developing a working version of the program. That way, youll have something to show for your efforts if you run out of time. Then, you can build out that version of the program until it satisfies all of the specifications.
From chapter 5 on, you should use top-down coding and testing as you develop your programs. You might also want to sketch out a hierarchy chart for each program as a guide to your top-down coding.
Chapter 2: Calculate a players batting average
Create a program that displays a welcome message and calculates a players batting average.
Console
================================================================ |
Baseball Team Manager This program calculates the batting average for a player based on the player's official number of at bats and hits. ================================================================ Player's name: Official number of at bats: Number of hits: |
Pat's batting average is 0.000 |
Specifications
- The formula for calculating batting average is: average = hits / at_bats The program should accept integer entries.
- Assume the user will enter valid data.
- The program should round the batting averages to a maximum of three decimal places.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started