The oncampus copy center wants you to write a program to cal
The on-campus copy center wants you to write a program to calculate what it should charge a faculty member for copies. Here is how the copy center charges a faculty member: o They charge 5 cents per copy for the first 100 copies, and 3 cents per copy thereafter. o If the number of copies exceed 1000, then the copy center will give the faculty member a 10% discount. R E Q U I R E M E N T S 1. Use three functions in this program. Functions should do the following a. get the number of copies b. calculate the charge c. display the number of copies, charges, and the discount if applicable. 2. In the “Algorithm” section of your Lab Report, fill in the algorithm for the main function and each function. 3. The test data you create must test each branch of the decision statements in your pseudocode. 4. Have an Instructor view your run before submitting your code 5. Complete and submit the Lab Report by 11:15 AM on Friday
Solution
#include <stdio.h>
int getCopies() //function to input the number if copies
{
int copies;
printf(\"Enter the Number of copies \");
scanf(\"%d\",&copies);
return copies;
}
float calculateCharge(int copies) //calculate charge of copying for copies
{
float charge;
if(copies <= 100)
charge = 0.05 * copies;
else if(copies >100 && copies <= 1000)
charge = 100* 0.05 + (copies-100)*0.03;
else if(copies >1000)
{
charge = 100* 0.05 + (copies-100)*0.03;
charge = charge - charge*0.1 ;
}
return charge;
}
void displayDetails(int copies,float charge,float discount) //display
{
printf(\"\ Number of copies :%d\",copies);
printf(\"\ Total Charge $:%.2f \",charge);
printf(\"\ Discount :%.2f percent\",discount);
}
int main(void)
{
int copies;
float charge,discount;
copies = getCopies();
if (copies >1000)
discount =0.1;
else
discount =0;
charge = calculateCharge(copies);
displayDetails(copies,charge,discount);
return 0;
}
output:

