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

Create one program that calls four functions. Function 1: void WeatherTalk() { /

ID: 3673007 • Letter: C

Question

Create one program that calls four functions.

Function 1:

void WeatherTalk()

{

/* Here you should have 3-4 printfs talking about the weather */

}

Function 2:

int GetRandomTimesFive()

{

/* Start by getting a random number from 5 to 50 */

/* Multiply the random number by 5 */

/* Return the result */

}

Function 3:

int GetUserChoice( int Min, int Max )

{

/* Ask the user for a number from min to max */

/* Make sure their number is in the range from min to max */

/* Return the choice */

}

Function 4:

float CalcSalesTax( float Amount, float TaxRate )

{

/* Calc sales tax on an amount */

/* Return sales tax */

}

TAs will use the following main to grade. You should use to test.

int main()

{

int Choice;

float SalesTax;

int Rnd;

  WeatherTalk();

Rnd= GetRandomTimesFive();

printf( "The random number is %d ", Rnd );

Choice = GetUserChoice( 1, 5 );

printf( "The choice was %d ", Choice );

SalesTax = CalcSalesTax( 10.00, 5.5 );

printf( "The sales tax is %.2f ", SalesTax );

}

Notes:

1. Do not use srand to seed the random number generator.

2. Only include stdio.h and stdlib.

(I need help writing the c code. I use virtual studios in my class)

Explanation / Answer


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

//Function 1:
void WeatherTalk()
{
    printf(" Weather Talk ");
    printf("Several tornado outbreaks already in 2016 have the severe weather count off to a roaring start ");
    printf("The preliminary count of tornadoes from the Storm Prediction Center (based on Local Storm Reports from the National Weather Service offices) is 132 ");
    printf("This is nowhere near a record but it is above the average count to date. ");
    printf("Over an entire year, the number of reported tornadoes varies from fewer than 1000 to more than 2000 ");
}

//Function 2:

int GetRandomTimesFive()

{
/* Start by getting a random number from 5 to 50 */
    int r = rand()%46+5;

/* Multiply the random number by 5 */
    r = r*5;

/* Return the result */
    return r;
}

//Function 3:

int GetUserChoice( int Min, int Max )

{
    int choice;
/* Ask the user for a number from min to max */
    printf("Enter number from %d to %d ", Min, Max);
    scanf("%d",&choice);
/* Make sure their number is in the range from min to max */
    while(!(choice>=Min&&choice<=Max))
    {
        printf("You didn't entered in range. Please try again ");
        printf("Enter number from %d to %d ", Min, Max);
        scanf("%d",&choice);
    }

/* Return the choice */
    return choice;

}

//Function 4:

float CalcSalesTax( float Amount, float TaxRate )

{
    float SalesTax;
/* Calc sales tax on an amount */
    SalesTax = Amount*TaxRate*0.01;

/* Return sales tax */
    return SalesTax;

}

//TAs will use the following main to grade. You should use to test.

int main()

{

int Choice;
float SalesTax;
int Rnd;

WeatherTalk();

Rnd= GetRandomTimesFive();
printf( "The random number is %d ", Rnd );

Choice = GetUserChoice( 1, 5 );
printf( "The choice was %d ", Choice );

SalesTax = CalcSalesTax( 10.00, 5.5 );
printf( "The sales tax is %.2f ", SalesTax );
}

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