Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LAB 4 FUNCTIONS OBJECTIVES In this lab assignment, students will learn: - How to define and call void functions - How to define and call
LAB 4 FUNCTIONS OBJECTIVES In this lab assignment, students will learn: - How to define and call void functions - How to define and call value returning functions - How to define functions with value and reference parameters COURSE PREPARATION Read the following documents: - Chapter 6 of the lecture slides and e-textbook. - CSC134-Coding Guidelines.doc posted in Course Resources Tutorials and Guidelines to Create and Submit C++ Programs. GRADING RUBRIC - Indent code and insert comments to document your program. [10 pts] - Program must be implemented and run as instructed to receive full credit. [80 pts] Programs that do not compile and run receive a 0 in credit. If you are having trouble getting your program to compile, comment out code until it compiles. This way, I can see what you were trying to accomplish and give partial credit. - Submit the C++ programs to Blackboard correctly. [10 pts] The sports analyst needs to calculate the statistics for a quarterback's passing. Write a C++ program "Lab4" to calculate completion percentages based on the number of passing attempts and completions made. The statistics will also be based on the yardage. Your program should include the following functions main0 Declare all variables needed for the program. - Call all functions listed below and assign the returned values to the corresponding variables. - Display percentage of completions for 0-15 yards, percentage of completion for 16-25 yards, display percentage of completion for more than 25 yards. All percentages should display 2 decimal points. getAttempts 15 () - Value-returning function - Asks for the number of passing attempts ( 015 yards) and use a return statement to send it to main. getCompletions15 () - Value-returning function - Asks for the number of completions made ( 015 yards) and use a return statement to send it to main. getAttempts 25() - Value-returning function - Asks for the number of passing attempts (16-25 yards) and use a return statement to send it to main. getCompletions25 () - Value-returning function - Asks for the number of completions made (16-25 yards) and use a return statement to send it to main. getAttempts.More25() - Value-returning function - Asks for the number of passing attempts (more than 25 yards) and use a return statement to send it to main. getCompletionsMore25 () - Value-returning function - Asks for the number of completions made (more than 25 yards) and use a return statement to send it to main. calc15Percent - Pass in values from getAttempts15 and getCompletions15 - Value-returning function. - Calculates the the percentage completions (completions/attempts). Use a return statement to send it to main 0 . calc 25 Percent Pass in values from getAttempts 25 and getCompletions 25 - Value-returning function. - Calculates the the percentage completions (completions/attempts). Use a return statement to send it to main 0 . calcMore25Percent - Pass in values from get AttemptsMore 25 and getCompletionsMore 25 - Value-returning function. - Calculates the the percentage completions (completions/attempts). Use a return statement to send it to main (). NOTE: - Although the number of completions is an integer, the percentage should be double value. You need to convert either numerator or denominator to double type in the division calculation, for example --double percent = static_cast> (completions) / attempts; - The problem requires that you determine the parameters needed for each function. - The main 0 function should display ALL the statistics on the computer screen. Sample input / output EN Microsoft Visual Studio Debug Console Enter number of attempts from 015 yards: 2 Enter number of completions from 015 yards: 1 Enter number of attempts from 1625 yards: 8 Enter number of completions from 1625 yards: 5 Enter number of attempts from more than 25 yards: 7 Enter number of completions from more than 25 yards: 5 Percentage of passing between 015 yards is 0.50 Percentage of passing between 1625 yards is 0.62 Percentage of passing more than 25 yards is 0.71 SUBMISSION Submit the following zip files through the lab4 assignment link at Black Board for credits. - "YourLastname_Lab4.zip
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