Question
Introduction to C Programming COP 3223 Objectives 1. To reinforce basic programming constructs 2. To learn how to use for loops Introduction: Who doesnt love
Introduction to C Programming COP 3223
Objectives
1. To reinforce basic programming constructs
2. To learn how to use for loops
Introduction: Who doesnt love dragons?
Movies about dragons and dragon training were very popular this summer. Your friend has not stopped talking about how awesome dragons are and how cool it would be to train them. To amuse your friend, you have decided to create a series of programs about dragons.
Problem: Flight Training (dragonflying.c)
Our dragons have stopped falling and can now make regular short flights. The only way to get better and strengthen their wings for longer flights is for the dragons to practice regularly. This program will track practice flights over a series of days and print out the average distance for each day.
To begin this program, you should first ask the user how many days the dragon has been practicing. Then, for each day ask how many practice flights were completed. Following that, ask for the distance for each practice flight.
Calculate the average distance for each day and print it so the dragon can see if they are getting stronger.
Input Specification
1. The number of days will be a positive integer.
2. The number of flights will be a positive integer.
3. The distance for each flight will be a positive real number.
Output Specification
Output the average distance for each day to three decimal places.
Day #Y: The average distance is X.XXX.
Output Sample
Below are some sample outputs of running the program. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for claritys sake.)
Sample Run
How many days has your dragon been practicing?
3
How many flights were completed in day #1? 2
How long was flight #1?
10.00
How long was flight #2?
15.00
Day #1: The average distance is 12.500.
How many flights were completed in day #2?
3
How long was flight #1?
9.50
How long was flight #2?
12.00
How long was flight #3?
13.25
Day #2: The average distance is 11.583.
How many flights were completed in day #3?
3
How long was flight #1?
10.00
How long was flight #2?
12.50
How long was flight #3?
15.00
Day #3: The average distance is 12.500.
Deliverables
One source files dragonflying.c is to be submitted over WebCourses.
Restrictions
Although you may use other compilers, your program must compile and run using Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include comments throughout your code describing the major steps in solving the problem.
Grading Details
Your programs will be graded upon the following criteria:
1) Your correctness
2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade.
3) Compatibility You must submit C source files that can be compiled and executed in a standard C Development Environment. If your program does not compile, you will get a sizable deduction from your grade.
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