Programming c assignment 7 help

// Fill in your own header comment

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

// Constants to be used.

// Passing score
#define SCORE 70

// Symbolic constants for true and false.
#define FALSE 0
#define TRUE 1

// Function prototypes – do not change these
void set_stats(int * d_strength, int * d_intel, int * d_agil);
void print_stats(int strength, int intelligence, int agility, char name[]);
int menu();
int weather();
int train_strength(int weather, char name[]);
int train_intelligence(int weather, char name[]);
int train_agility(int weather, char name[]);
int obstacle_course(int weather, int strength, int intel, int agility);
void end_message(int completed, char name[]);

// Main function
int main() {
    int num_day, ans, weather_value, score = 0, completed = FALSE;
    int dragon_strength, dragon_intelligence, dragon_agility;

    char name[20], answer[4];

    srand(time(0));

    printf(“Welcome to Dragon Training!n”);
    printf(“You’ve been assigned a new dragon! Would you like to give it a name? (yes/no)n”);
    scanf(“%s”, answer);

    if(strcmp(answer, “yes”) == 0) {
        printf(“Great! What would like to call your dragon?n”);
        scanf(“%s”, name);
    }
    else
        strcpy(name, “your dragon”);

    printf(“nTo complete training, %s must finish the final nobstacle course with a score of 70 or better.n”, name);
    printf(“nYou may attempt the obstacle course at any time, nbut you must finish within 10 days.n”);
    printf(“nBetter get started!n”);

    set_stats(&dragon_strength, &dragon_intelligence, &dragon_agility);

    for (num_day = 1; num_day <= 10; num_day++) {
        printf(“nIt is Day #%d.n”, num_day);
        print_stats(dragon_strength, dragon_intelligence, dragon_agility, name);
        weather_value = weather();
        ans = menu();

        switch(ans) {
            case 1:
                dragon_strength += train_strength(weather_value, name);
                break;
            case 2:
                dragon_intelligence += train_intelligence(weather_value, name);
                break;
            case 3:
                dragon_agility += train_agility(weather_value, name);
                break;
            case 4:
                score = obstacle_course(weather_value, dragon_strength, dragon_intelligence, dragon_agility);
                printf(“%s scored a %d on their obstacle course run!n”, name, score);
                break;
        }

        if(score >= SCORE) {
            completed = TRUE;
            break;
        }
    }

    end_message(completed, name);

  return 0;
}

// Pre-conditions: d_strength, d_intel, and d_agil are pointers to variables that store
//                 the dragon’s strength, intelligence, and agility statistics.
// Post-condition: Each of the dragon’s statistics are set to a pseudorandom
//                 initial value.
//
// What to do in this function: Set each of the dragon’s values to a
// pseudorandom initial value.
// Strength should be a random value from 0-99.  Then add 5 to make sure the
// dragon has at least 5 strength.
// Intellect should be a random value from 1-10.
// Agility should be a random value from 0-19.  Then add 2 to make sure the
// dragon has at least 2 agility.

void set_stats(int * d_strength, int * d_intel, int * d_agil) {

}

// Pre-conditions: There are no parameters for this function.
// Post-condition: The user is presented with a menu and given
//                 the opportunity to respond. If they respond with
//                 a valid menu option, return the user’s choice.
//
// What to do in this function: Prompt the user with the menu and
// read in their response.  If their answer is less than 0 or greater
// than 5, continue to prompt them until they provide a valid answer.
// Then, return their answer.
int menu() {

}

// Author: Arup Guha
// Pre-condition: None
// Post-condition: The weather report for the day is printed and the
//                 corresponding weather status in between 1 and 5,
//                 inclusive, is returned.
int weather() {
  // Get the weather status value.
  int retval = rand()%5 + 1;

  printf(“nHere is today’s weather forecast:n”);

  // Print out the appropriate forecast for that status.n”);
  if (retval == 1)
    printf(“It is cloudy with a high chance of rain.n”);
  else if (retval == 2)
    printf(“It is partly cloudy and windy.n”);
  else if (retval == 3)
    printf(“It is partly sunny with low humidity.n”);
  else if (retval == 4)
    printf(“It is warm and sunny with medium winds.n”);
  else
    printf(“It’s a perfect beach day. Sunny and hot!n”);

    printf(“n”);

  return retval; // Return this status value.
}

// Pre-condition: strength, intelligence, agility, and name are variables
//                that represent the name of the dragon and it’s stats
// Post-condition: A listing of the dragon’s stats are printed
//
// What to do with this function: This is fairly self-explanatory from the
// pre and post conditions. Look to the sample given in the assignment for
// the format.
void print_stats(int strength, int intelligence, int agility, char name[]) {

}

// Pre-condition: weather is an integer from 1-5 that represents the
//                current day’s forecast.  name is the dragon’s name.
// Post-condition: A day’s strength taining is carried out.  The current
//                 gain in strength is printed and returned.
//
// What to do with this function: First, determine the maximum possible
// gain in strength by mutliplying the weather by 3 and adding 5.
// If the maximum possible gain is less than 10, set it to 10.
// Then, determine the actual gain by generation a psuedorandom
// number between 1 and the maximum gain.
// Print the amount of strength gained according to the sample run,
// and return that value
int train_strength(int weather, char name[]) {

}

// Pre-condition: weather is an integer from 1-5 that represents the
//                current day’s forecast.  name is the dragon’s name.
// Post-condition: A day’s knowkedge taining is carried out.  The current
//                 gain in knwoledge is printed and returned.
//
// What to do with this function: First, determine the maximum possible
// gain in knowledge by dividing 15 by the weather and adding 5.
// If the maximum possible gain is less than 10, set it to 10.
// Then, determine the actual gain by generation a psuedorandom
// number between 1 and the maximum gain.
// Print the amount of intellect gained according to the sample run,
// and return that value
int train_intelligence(int weather, char name[]) {

}

// Pre-condition: weather is an integer from 1-5 that represents the
//                current day’s forecast.  name is the dragon’s name.
// Post-condition: A day’s agility taining is carried out.  The current
//                 gain in agility is printed and returned.
//
// What to do with this function: First, determine the maximum possible
// gain in agility using the following function: 13 + weather%5 + (weather+4)%5
// Then, determine the actual gain by generation a psuedorandom
// number between 1 and the maximum gain.
// Print the amount of agility gained according to the sample run,
// and return that value
int train_agility(int weather, char name[]) {

}

// Pre-condition: weather is an integer from 1-5 that represents the
//                current day’s forecast.  strength, intel, and agility
//                are variables representing the dragon’s stats
// Post-condition: A day’s obstacle course is run and a score for the
//                 run is returned.
int obstacle_course(int weather, int strength, int intel, int agility){
    return 10 + 2*weather + strength/4 + intel + agility/2;
}

// Pre-condition: completed is an integer that represents either TRUE or FALSE
//                name is the dragon’s name.
// Post-condition: The user’s overall result is printed out.
//
// What to do with this function: See if the dragon completed the obstacle
// course.  Print the appropriate response according to the sample run.
void end_message(int completed, char name[]) {

}

Essay Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.