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

Write a C program named money.c that calculates daily admission revenue for an a

ID: 669601 • Letter: W

Question

Write a C program named money.c that calculates daily admission revenue for an art museum. The program uses three functions in its calculations. The program should: • Read in the number of adults admitted that day, adult admission is $8.50 • Read in the number of children admitted that day, child admission is $4.50 • Calculate the adult, child and total revenue generated for the day • Prins the admissions as well as adult, child and total revenue generated A skeleton of the main program is shown below. #include // getAdmits prints the character prompt and then reads and returns and integer value int getAdmits(char *); // calculateRevenue takes number of admits, charge per admission double calculateRevenue(int, double); // printResults takes adult admits, child admits, adult revenue, child revenue, total revenue void printResults(int, int, double, double, double); int main( ) { // declare variables // use two calls to getAdmits to read the number of adult and child admissions // use two calls to calculateRevenue to calculate the adult and child revenue // compute the total revenue, which is adult revenue plus child revenue // print the output (see below for sample output) return 0; } Sample output from this program is shown below: Enter the number of adult admissions : 20 Enter the number of child admissions : 10 Revenue for the day was 215.000000 170.000000 from 20 adult admissions 45.000000 from 10 child admissions

Explanation / Answer

#include<stdio.h>
double calculateRevenue(int a, double c){
double total=a*c;

return total;
}
int getAdmits(char *t){
int a;
  
printf("Number of %s admitted: ",t);
scanf("%d",&a);
return a;
}
void printResults(int a,int c,double aR,double cR,double total){
printf("Revenue for the day was %f %f from %d adult admissions %f from %d child admissions ",total,aR,a,cR,c);
}
int main(){
int a,c;
a=getAdmits("adults");
c=getAdmits("Children");


double aR=calculateRevenue(a,8.50);
double cR=calculateRevenue(c,4.50);

double total=aR+cR;
printResults(a,c,aR,cR,total);
return 0;
}

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