Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Skeleton code: Sample output: Obiectives 1. To learn how to write functions give

ID: 3701814 • Letter: S

Question


Skeleton code:




Sample output:


Obiectives 1. To learn how to write functions given specifications 2. To learn how to the use pass by value and pass by reference variables 3. Review previous concepts like if-statements and loops. Movies about dragons and dragon training were very popular this summer. Your fiend 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 dragon-training simulator using your C programming skills. The basic idea behind the simulation is as follows: 1) You will simulate 10 days of dragon training 2) In the beginning the user gets a new dragon with some initial statistics for strength, intellect, and agility 3) At the beginning of each day the user receive a weather report. 4) Based on that, the user can determine which tasks their dragon should complete that day 5) Then, the day's activity is simulated After 10 days the simulation ends and the user is told whether or not they have completed training Training may be completed earlier than 10 days if the obstacle course is completed A skeleton of the solution for this assignment is posted on the webcourse. You must fill in the seven functions that are currently empty. After you write each function, you should test it before moving on. The main function should not be modified for the final submission (you may modify it during testing, as long as you return it to its initial form) Descriptions of each function are given in the skeleton along with the function Pre- and Post-conditions. The output samples at the end of this document show the wording you should use and how the program should run when completed. Points are allotted for following the precise wording shown

Explanation / Answer

In the first problem we can not set the result to a variable.to fix that,we need to add another variable and set the value of it to the result of the calculation like:

#include<stdio.h>

int main()

{

//variable Declaration

int weight,sheep;

//prompt user for input information

printf("How much does your dragon weight? ");

scanf("%d",&weight);

//Calulations

sheep=pounds/2.2*1.5;

//output

printf(""dragon weights %d pounds! ,pounds);

return 0;

}

calculation is per day while the results must be per month(30 days) so calculation should actully be

sheep=(weight/2.2*1.5*30)/200;

to calculate how many sheep the dragon needs per month.to fix that,you need to change your output to:

printf("you will need %d sheep for your new dragon ",sheep);

after all,it should look like:

#include<stdio.h>

int main()

{

//variable declaration

int weight,sheep;

//user for input information

printf("how much does your dragon weight? ");

scanf("%d",&weight);

//calculations

sheep=weight/2.2*1.5*30/200;

//output

printf("your dragon weights %d pounds! ",weight);

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote