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

Write function headers with comments for the tasks described below. a. Computing

ID: 3796588 • Letter: W

Question

Write function headers with comments for the tasks described below.

a. Computing the larger of two integers

b. Computing the smallest of three oating-point numbers
c. Checking whether an integer is a prime number, returning True if it is and

False otherwise

d. Checking whether a string is contained inside another string

e. Computing the balance of an account with a given initial balance, an annual interest rate, and a number of years of earning interest

f. Printing the balance of an account with a given initial balance and an annual interest rate over a given number of years

g. Printing the calendar for a given month and year
h. Computing the day of the week for a given day, month, and year (as a string

such as "Monday")
i. Generating a random integer between 1 and n

Explanation / Answer

a. Computing the larger of two integers

b. Computing the smallest of three floating-point numbers
c. Checking whether an integer is a prime number, returning True if it is and

False otherwise

d. Checking whether a string is contained inside another string

e. Computing the balance of an account with a given initial balance, an annual interest rate, and a number of years of earning interest

f. Printing the balance of an account with a given initial balance and an annual interest rate over a given number of years

g. Printing the calendar for a given month and year
h. Computing the day of the week for a given day, month, and year (as a string

such as "Monday")
i. Generating a random integer between 1 and n

// function returning the max between two numbers and numbers as parameters

int max(int num_1, int num_2)

{

//local varaiable declaration

}

//this function gives us the smallest among the floats

float min( float num_1, float_num2, float num3)

{

//declaring the local variables

}

//

int intergerfinder(int number)

{

//local varaibles

int n, I;

Bool isprime = true;

cout << “Enter a positive interger:”;

cin >> n

for(I = 2; I <=n/2; ++i)

{

If (n%1 == 0)

{

    IsPrime = flase;

    Break

}

return 0

}

//function to find the string inside a string

//passing parameters from the main function

strfinder(string a, string b)

}

// the totalbalance will in decimals so we choose data type float and similarly the years like 8.5 years

float accountbal(float bal, float intrest, float years)

//declaring the local varaibles

Generating a random integer between 1 and n

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