Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the

Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the Shrink function.

#include

int Square(int value);

int Cube(int value);

double shrink(int value);

int main ()

{

int intValue, menuSelect,Results;

intValue = 1;

// While a positive number

printf ("Enter a positive Integer : ");

scanf("%d", &intValue);

if (intValue > 0)

{

printf ("Enter 1 to calculate Square, 2 to Calculate Cube 3 to Shrink : ");

scanf("%d", &menuSelect);

if (menuSelect == 1)

{

// Call the Square Function

Results = Square(intValue);

printf("Square of %d is %d ",intValue,Results);

}

else if (menuSelect == 2)

{

// Call the Cube function

Results = Cube(intValue);

printf("Cube of %d is %d ",intValue,Results);

}

else if (menuSelect == 3){

//call the shrink function

double Result=shrink(intValue);

printf("%d value after shrink %lf",intValue,Result);

}

}

return 0;

}

/* function returning the Square of a number */

int Square(int value)

{

return value*value;

}

/* function returning the Cube of a number */

int Cube(int value)

{

return value*value*value;

}

double shrink(int value){

return value/2;

}

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

Do they appear to be stressed out?

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago