0% found this document useful (0 votes)
19 views4 pages

Commission Calculation Program Analysis

The document outlines a C program that calculates total sales and commission based on user input for locks, stocks, and barrels, with specific price points for each. It includes boundary value testing to validate input ranges for locks (1-70), stocks (1-80), and barrels (1-90), ensuring that totals do not exceed these limits. The program computes the commission based on total sales, applying different rates depending on the sales amount.

Uploaded by

ravishravi153
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Commission Calculation Program Analysis

The document outlines a C program that calculates total sales and commission based on user input for locks, stocks, and barrels, with specific price points for each. It includes boundary value testing to validate input ranges for locks (1-70), stocks (1-80), and barrels (1-90), ensuring that totals do not exceed these limits. The program computes the commission based on total sales, applying different rates depending on the sales amount.

Uploaded by

ravishravi153
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Design, develop, code and run the program in any suitable language to
solve the commission problem. Analyse it from the perspective of boundary
value testing, derive different test cases, execute these test cases and discuss
the test results.
#include<stdio.h>
#include<conio.h>
int main()
{
int c1,c2,c3,temp;
int locks,stocks,barrels,totallocks,totalstocks,totalbarrels;
float lockprice,stockprice,barrelprice,locksales,stocksales,barrelsales,sales,com;
lockprice=45.0;
stockprice=30.0;
barrelprice=25.0;
totallocks=0;
totalstocks=0;
totalbarrels=0;

printf("Enter the number of locks and to exit press -1\n");


scanf("%d",&locks);
while(locks != -1)
{
c1=(locks<=0 || locks>70);
printf("\nEnter the number of stocks and barrels\n");
scanf("%d %d",&stocks,&barrels);
c2=(stocks<=0 || stocks>80);
c3=(barrels<=0 || barrels>90);
if(c1)
printf("\nValue of locks are not in the range of 1....70\n");
else
{
temp=totallocks+locks;
if(temp>70)
printf("New totallocks = %d not in the range of 1....70\n",temp);
else
totallocks=temp;
}
printf("Total locks = %d",totallocks);
if(c2)
printf("\n Value of stocks not in the range of 1....80\n");
else
{
temp=totalstocks+stocks;
if(temp>80)
printf("\nNew total stocks = %d not in the range of 1....80",temp);
else
totalstocks=temp;
}
printf("\nTotal stocks = %d",totalstocks);
if(c3)
printf("\n Value of barrels not in the range of 1....90\n");
else
{
temp=totalbarrels+barrels;
if(temp>90)
printf("\nNew total barrels = %d not in the range of 1....90\n",temp);
else
totalbarrels=temp;
}
printf("\nTotal barrels=%d", totalbarrels);
printf("\nEnter the number of locks and to exit press -1\n");
scanf("%d",&locks);
}
printf("\n Total locks = %d",totallocks);
printf("\n Total stocks = %d",totalstocks);
printf("\n Total barrels = %d",totalbarrels);
locksales=totallocks*lockprice;
stocksales=totalstocks*stockprice;
barrelsales=totalbarrels*barrelprice;
sales=locksales+stocksales+barrelsales;
printf("\n Total sales = %f",sales);
if(sales>1800)
{
com=0.10*1000;
com=com+(0.15*800);
com=com+0.20*(sales-1800);
}
else if(sales>1000)
{
com=0.10*1000;
com=com+0.15*(sales-1000);
}
else
com=0.10*sales;
printf("\nCommission = %f",com);

return 0;
}

You might also like