#include <stdio.h>#include <stdlib.h> //declaring variables globally to calculate coinsint cent50 = 0;int cent20 = 0;int cent10 = 0;int cent05 = 0; //calculate change//pass change variable by addressvoid calculateChange(int* change) {//calculate change only if change is positiveif(*change > 0) {if(*change >= 50) {*change -= 50;cent50++;}else if(*change >= 20) {*change -= 20;cent20++;}else if(*change >= 10) {*change -= 10;cent10++;}else if(*change >= 05) {*change -= 05;cent05++;}//call calculateChange recursively calculateChange(change);}} // function to display the cents valuesvoid printChange() { if(cent50)printf("\n50 Cents : %d coins", cent50);if(cent20)printf("\n20 Cents : %d coins", cent20);if(cent10)printf("\n10 Cents : %d coins", cent10);if(cent05)printf("\n05 Cents : %d coins", cent05);//reset all cent variables with 0cent50 = 0;cent20 = 0;cent10 = 0;cent05 = 0; } //take change input from user//change variable passed addressvoid TakeChange(int* change) {//take input from user as change scanf("%d", change);//read the new line character left unread by scanfgetchar();} //main functionint main() {//declare and initialize variable change with 0int change = 0;//for giving different message on consoleint firstInput = 0;//loop goes on till user enters -1 to exit the loopwhile(1){if(!firstInput){printf("\nEnter the amount: ");firstInput++; }else{printf("\n\nEnter the amount to continue or Enter -1 to exit:");}//take change value as input from userTakeChange(&change);//check if changes is within range[5,95]if(change >=5 && change <= 95){//calculate coins change till change variable value is positive//if change is multiple of 5if((change % 5)==0){//if change value is within range[5,95]if(change >= 5 && change <=95 ){//Calculate coins//pass value by address so that//when change variable value is decrease// change is reflected//in main function as wellcalculateChange(&change); }}}else{//end the loopif(change == -1){//exit the loopprintf("\nExiting the loop..");break;}else{printf("Please Enter the value between 5 and 95"); }}//Print coinsprintChange();}printf("\nLoop is terminated..");return 0;} Results of applying  test data to  final program (tabular form), including a sample printout of the program in operation please??  Each test id tests only one situation for the test run of the program. This table is a copy/paste of the desk check, except the actual output column shows the results of the actual program output.    Test id Test description/justification – what is the test for and why this particular test. Actual data for this test Expected output Actual program output when test is carried out Test outcome – Pass/Fail 1           2           3           4

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

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

//declaring variables globally to calculate coins
int cent50 = 0;
int cent20 = 0;
int cent10 = 0;
int cent05 = 0;

//calculate change
//pass change variable by address
void calculateChange(int* change) {

//calculate change only if change is positive
if(*change > 0) {
if(*change >= 50) {
*change -= 50;
cent50++;
}
else if(*change >= 20) {
*change -= 20;
cent20++;
}
else if(*change >= 10) {
*change -= 10;
cent10++;
}
else if(*change >= 05) {
*change -= 05;
cent05++;
}
//call calculateChange recursively
calculateChange(change);
}
}


// function to display the cents values
void printChange() {

if(cent50)
printf("\n50 Cents : %d coins", cent50);

if(cent20)
printf("\n20 Cents : %d coins", cent20);

if(cent10)
printf("\n10 Cents : %d coins", cent10);

if(cent05)
printf("\n05 Cents : %d coins", cent05);

//reset all cent variables with 0
cent50 = 0;
cent20 = 0;
cent10 = 0;
cent05 = 0;

}

//take change input from user
//change variable passed address
void TakeChange(int* change) {
//take input from user as change
scanf("%d", change);

//read the new line character left unread by scanf
getchar();

}

//main function
int main() {
//declare and initialize variable change with 0
int change = 0;

//for giving different message on console
int firstInput = 0;

//loop goes on till user enters -1 to exit the loop
while(1){
if(!firstInput){
printf("\nEnter the amount: ");
firstInput++;
}else{
printf("\n\nEnter the amount to continue or Enter -1 to exit:");
}
//take change value as input from user
TakeChange(&change);

//check if changes is within range[5,95]
if(change >=5 && change <= 95)
{
//calculate coins change till change variable value is positive
//if change is multiple of 5
if((change % 5)==0)
{
//if change value is within range[5,95]
if(change >= 5 && change <=95 )
{
//Calculate coins
//pass value by address so that
//when change variable value is decrease
// change is reflected
//in main function as well
calculateChange(&change);
}
}
}
else{
//end the loop
if(change == -1){
//exit the loop
printf("\nExiting the loop..");
break;
}else{
printf("Please Enter the value between 5 and 95");
}
}
//Print coins
printChange();
}

printf("\nLoop is terminated..");
return 0;
}

Results of applying  test data to  final program (tabular form), including a sample printout of the program in operation please??

 Each test id tests only one situation for the test run of the program. This table is a copy/paste of the desk check, except the actual output column shows the results of the actual program output. 

 

Test id

Test description/justification – what is the test for and why this particular test.

Actual data for this test

Expected output

Actual program output when test is carried out

Test outcome – Pass/Fail

1

 

 

 

 

 

2

 

 

 

 

 

3

 

 

 

 

 

4

 

 

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage