Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is to be written in C programming. I am new to programming so please keep it quite basic but readable (function calls, if/else if/else,

this is to be written in C programming. I am new to programming so please keep it quite basic but readable (function calls, if/else if/else, and for loops). Please do not use scanf, pointers, arrays, and if you could include comments explaining certain steps that would be awesome. Thanks! image text in transcribed
image text in transcribed
image text in transcribed
Part 1 - Loops that accumulate a result 1. Design the function sum_odd that takes an integer n, and sums all of the odd numbers from 0 to n inclusive. The function must return the sum. Don't forget to write your tests. Part 2 - Loops that print output In this part of the assignment you are going to write a set of functions that will be used to output an ascii image of a Rocket. A cropped screenshot of a sample output is shown here on the right: The draw_rocket function that you will design will take two arguments: 1) an integer for the size of the rocket in this example the size is 2) 2) an integer for the number of boosters the rocket will have in this example there are 2 boosters) To encourage good software development practices we are requiring you to write and call a specified set of helper functions in your implementation You are free to include additional functions, but to receive full marks your implementation must include the required set described on the following page. The prototypes for each of these function have been added to assignment 4.c. Tip: You can write the helper functions in any order. Start with one of the simpler ones first such as the instrument_unit function. 1/**\\ ///**\\ +=*=*=*=*+ // & & & & // & & & & &\\ +=*=*=*=*=*=*+ 11-#-#-#-#-#| 11-#-#-#-#-#|| +=*=*=*=*=*=*+ |../..../.. 1./\\..//. 1/WWW VVVVVI | V\.. \.| 1..V....V.. +=*=*=*=*=*=*+ |../..../\.. 1./\\..\\. WWW \\\\\\ V\.. \.| 1..V....V..) +=*=*=*=*=*=*+ A A Decomposing the problem: We are asking you to decompose your program according to the following diagram, where you will implement at least one function for each of the diagrammed parts in the image below. This image was created with by calling draw_rocket with a size: 2 and number of boosters: 1 Space Craft +t=**=*+ 11 &&&& 11 &&&&& Lem Adapter 11-#-#-#-#-#11 11-#-#-#-#-#11 Instrument Unit + 1 ../..../..! ./V /V . AVVVVV VVVVVI | . \..\/\.| 1..V....V.. - Booster U A A Tail Your functions must adhere to the following specifications including function names and order of arguments. These functions must print the portion of the image in the figure above where the function name corresponds to the label name in the figure. For example, the draw_booster function must print all parts of the shape labeled "Booster" and enclosed in the red square in the figure above. A zero grade will be given for any function that does not follow the following specification: 1. draw tail must take as an argument one integer representing the size of the rocket it is being drawn for 2. draw_booster must take as an argument one integer representing the size of the rocket it is being drawn for and print only ONE booster 3. draw instrument_unit must take as an argument one integer representing the size of the rocket it is being drawn for 4. draw lem adapter must take as an argument one integer representing the size of the rocket it is being drawn for 5. draw_space_craft must take as an argument one integer representing the size of the rocket it is being drawn for draw_rocket must take as arguments an integer representing the size of the rocket and an integer representing the number of boosters to be printed. Your implementation of this function must make use of the other helper functions you have written to draw the rocket. More cropped screenshots of sample runs have been provided below to give you idea of how the rocket should scale with a change in size and number of boosters. Take your time with pen a paper to identify the relationship between the size and the output. Created with: Created with: Created with: draw_rocket (1,1) draw_rocket(3,2) draw_rocket (4,3) ////e //all ///elll M / /////call //////ell 111111/ ll 1/6611 // &&6 ES 11 &&&&&&11 11 & & & & & & 611 11- 4811 17 & 1/ & & & & & & & & & & & & & & & &\\ AAAIL 1./../.1 IMI WL 1.V..V. ../\/ ... WWW. \/\/\/ // A ll T.../...../.... 1.M ...M . J.M .M . II WWW T.WW.WW. 1..W ....W .. 1...V......V... |../ ...M . IMMI 1 www 1.W ..W .I T..W ....W .. I...V......V... 11 AAA // /

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions