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

I wrote this solution from chegg solutions but is not working when I run it. cou

ID: 3691074 • Letter: I

Question

I wrote this solution from chegg solutions but is not working when I run it.

could you correct it for me please?

this programming project is the project 2 from chapter 6 (textbook : Problem Solving and Program Design in C 7th edition).

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

int by_weight( rate, weight, concentration)
{
    int answer = ((rate * weight) / concentration);
    return (answer);
}

int fig_drop_min(int rate, int dropFactor)
{
    int drops;
    rate = (rate /60);
    drops = (dropFactor * rate);
    return (drops);
}

int fig_ml_hr(int rate)
{
    int ml;
    ml= (1000/rate);
    return (ml);
}

void get_kg_rate_conc()
{
    int answer;
    int weight;
    int concentration;
   
    print("enter rate in mg / kg /hr => ");
    scanf("%lf",&rate);
   
    print("Enter patient weight in kilogram=>");
    scanf("%d",&weight);
   
    print("Enter concentration in mg/ml=>");
    scanf("%d",&concentration);
   
    answer = by_weight(&rate,&weight,&concentration);
   
    printf(" The rate in milliliters per hour is %d", answer);
}
void which_problem()
{
    printf("INTRAVENOUS RATE ASSISTANT/nEnter the number of the problem you wish to solve./n GEVEN A MEDICAL ORDER IN");
}

void get_rate_drop_factor()
{
    int rate;
    int dropFactor;
   
    printf("Enter rate in ml/hr =>");
    scanf("%d",&rate);
   
    printf(" Enter tubing's drop factor(drop / ml)=>");
    scanf("%d",&dropFactor);
   
    rate = fig_drops_min(rate,dropFactor);
   
    printf("The drop rate per minute is %d",rate);
   
}
int get_units_conc()
{
printf("Enter rate in units/hr =>");
printf("Enter concentration in units/ml =>");
Printf("The rate in ml/hr is %d",);
}

int
main(void)
{
    int quit = 0;
    while(qui==0)
    {
        int choice;
        choice =get_problem();
        if(choice==1)
        {
            printf("Problem=>1");
            get_rate_drop_factor();
        }
        else if(choice ==2)
        {
            int answer;
            int rate;
            printf("Proble=>2");
            printf("Enter number of hours=>");
            scanf("%d",rate);
            answer = fig_ml_hr(&rate);
            printf("The rate in milliliters per hour is %d.",answer);
        }
        else if (choice==3)
        {
            printf("Problem=>3");
            get_kg_rate_conc();
        }
        else if (choice==4)
        {
            printf("Problem=>4");
            get_units_conc();
        }
        else if (choice == 5)
        {
            quit=1;
            printf("Problem=>5");
        }
     }
    return(0);
}

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>
int by_weight(double rate,int weight,int concentration)
{
int answer = ((rate * weight) / concentration);
return answer;
}
int fig_drop_min(int rate, int dropFactor)
{
int drops;
rate = (rate /60);
drops = (dropFactor * rate);
return (drops);
}
int fig_ml_hr(int rate)
{
int ml;
ml= (1000/rate);
return (ml);
}
void get_kg_rate_conc()
{
int answer;
int weight;
int concentration;
double rate;

printf("enter rate in mg / kg /hr => ");
scanf("%lf",&rate);

printf("Enter patient weight in kilogram=>");
scanf("%d",&weight);

printf("Enter concentration in mg/ml=>");
scanf("%d",&concentration);

answer = by_weight(rate,weight,concentration);

printf(" The rate in milliliters per hour is %d", answer);
}
int get_problem(){
int opt;
printf("INTRAVENOUS RATE ASSISTANT/nEnter the number of the problem you wish to solve./n GEVEN A MEDICAL ORDER IN");
scanf("%d",&opt);
return opt;
}
void get_rate_drop_factor()
{
int rate;
int dropFactor;

printf("Enter rate in ml/hr =>");
scanf("%d",&rate);

printf(" Enter tubing's drop factor(drop / ml)=>");
scanf("%d",&dropFactor);

rate = fig_drop_min(rate,dropFactor);

printf("The drop rate per minute is %d",rate);

}
int get_units_conc()
{
int rate,concentration;
printf("Enter rate in units/hr =>");
scanf("%d",&rate);
printf("Enter concentration in units/ml =>");
scanf("%d",&concentration);
printf("The rate in ml/hr is %d",rate);
}
int main(void){
int quit = 0;
while(quit!=1){
int choice;
choice = get_problem();
if(choice==1){
printf("Problem=>1");
get_rate_drop_factor();
}
else if(choice ==2)
{
int answer;
int rate;
printf("Proble=>2");
printf("Enter number of hours=>");
scanf("%d",rate);
answer = fig_ml_hr(rate);
printf("The rate in milliliters per hour is %d.",answer);
}
else if (choice==3)
{
printf("Problem=>3");
get_kg_rate_conc();
}
else if (choice==4)
{
printf("Problem=>4");
get_units_conc();
}
else
{
quit=1;
/* printf("Problem=>5");*/
}
}
return(0);
}