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

#include <stdio.h> float total(float,float,float); int units; int main() { int c

ID: 3604674 • Letter: #

Question

#include <stdio.h>

float total(float,float,float);
int units;
int main()
{
   int ch,c0ch1;//c0ch1 is the cases integer variable,ch is the choice for selecting session
   float enrollmentfee,studentservicesfee,stickerfee, idCardfee,parkingfee,totalfee;
   char choice; // it is for selecting yes or no i.e. y or n;
   printf("Hello world! ");
   printf("enter units ");
   scanf("%i", &units);
   printf("Is this Fall[0], Winter[1], Spring[2] or Summer[3] session ");
   scanf("%i", &ch);
   switch(ch)
   {
      case 0://for Fall
          printf("Are you a state resident[0] or not[1]: ");
          scanf("%i", &c0ch1);
          studentservicesfee=19;
          if(c0ch1==0)
          {
             enrollmentfee=46;
          }
          else if(c0ch1==1)
          {
             enrollmentfee=335;
          }
          printf("Want a parking decal? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             parkingfee=85;
          }
          else if(choice=='n' || choice=='N')
          {
             parkingfee=0;
          }
          printf("Want an AS sticker? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             stickerfee=19.5;
             studentservicesfee+=stickerfee;
          }
          else if(choice=='n' || choice=='N')
          {
             stickerfee=0;
             studentservicesfee+=stickerfee;
          }
          printf(" Want an ID card? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             idCardfee=13;
             studentservicesfee+=idCardfee;
          }
          else if(choice=='n' || choice=='N')
          {
             idCardfee=0;
             studentservicesfee+=idCardfee;
          }
          totalfee=total(enrollmentfee,parkingfee,studentservicesfee);
          printf("For Fall semester, your total fees are : %.2f ", totalfee);
          break;
      case 1:// for winter
          printf("Are you a state resident[0] or not[1]: ");
          scanf("%i", &c0ch1);
          studentservicesfee=16;
          if(c0ch1==0)
          {
             enrollmentfee=46;
          }
          else if(c0ch1==1)
          {
             enrollmentfee=335;
          }
          printf("Want a parking decal? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             parkingfee=45;
          }
          else if(choice=='n' || choice=='N')
          {
             parkingfee=0;
          }
          printf("Want an AS sticker? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             stickerfee=19.5;
             studentservicesfee+=stickerfee;
          }
          else if(choice=='n' || choice=='N')
          {
             stickerfee=0;
             studentservicesfee+=stickerfee;
          }
          printf(" Want an ID card? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             idCardfee=13;
             studentservicesfee+=idCardfee;
          }
          else if(choice=='n' || choice=='N')
          {
             idCardfee=0;
             studentservicesfee+=idCardfee;
          }
          totalfee=total(enrollmentfee,parkingfee,studentservicesfee);
          printf("For Fall semester, your total fees are : %.2f ", totalfee);
          break;
      case 2:// for spring
          printf("Are you a state resident[0] or not[1]: ");
          scanf("%i", &c0ch1);
          studentservicesfee=19;
          if(c0ch1==0)
          {
             enrollmentfee=46;
          }
          else if(c0ch1==1)
          {
             enrollmentfee=335;
          }
          printf("Want a parking decal? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             parkingfee=85;
          }
          else if(choice=='n' || choice=='N')
          {
             parkingfee=0;
          }
          printf("Want an AS sticker? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             stickerfee=19.5;
             studentservicesfee+=stickerfee;
          }
          else if(choice=='n' || choice=='N')
          {
             stickerfee=0;
             studentservicesfee+=stickerfee;
          }
          printf(" Want an ID card? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             idCardfee=13;
             studentservicesfee+=idCardfee;
          }
          else if(choice=='n' || choice=='N')
          {
             idCardfee=0;
             studentservicesfee+=idCardfee;
          }
          totalfee=total(enrollmentfee,parkingfee,studentservicesfee);
          printf("For Fall semester, your total fees are : %.2f ", totalfee);
          break;
      case 3:// for summer
          printf("Are you a state resident[0] or not[1]: ");
          scanf("%i", &c0ch1);
          studentservicesfee=16;
          if(c0ch1==0)
          {
             enrollmentfee=46;
          }
          else if(c0ch1==1)
          {
             enrollmentfee=335;
          }
          printf("Want a parking decal? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             parkingfee=45;
          }
          else if(choice=='n' || choice=='N')
          {
             parkingfee=0;
          }
          printf("Want an AS sticker? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             stickerfee=19.5;
             studentservicesfee+=stickerfee;
          }
          else if(choice=='n' || choice=='N')
          {
             stickerfee=0;
             studentservicesfee+=stickerfee;
          }
          printf(" Want an ID card? [y/n]: ");
          scanf(" %c", &choice);
          if(choice=='y' || choice=='Y')
          {
             idCardfee=13;
             studentservicesfee+=idCardfee;
          }
          else if(choice=='n' || choice=='N')
          {
             idCardfee=0;
             studentservicesfee+=idCardfee;
          }
          totalfee=total(enrollmentfee,parkingfee,studentservicesfee);
          printf("For Fall semester, your total fees are : %.2f ", totalfee);
          break;
      default: printf("please enter correct option ");
   }
   return 0;
}

float total(float enroll,float park,float service)
{
   enroll=enroll*units;
   printf("%f %f %f ", enroll, park, service);
   return (enroll+park+service);
}

Why does this code not work? #include float total(float,float,float); int units; int main() { int ch,c0ch1;//c0ch1 is the cases integer variable,ch is the choice for selecting session float enrollmentfee,studentservicesfee,stickerfee, idCardfee,parkingfee,totalfee; char choice; // it is for selecting yes or no i.e. y or n; printf("Hello world! "); printf("enter units "); scanf("%i", &units); printf("Is this Fall[0], Winter[1], Spring[2] or Summer[3] session "); scanf("%i", &ch); switch(ch) { case 0://for Fall printf("Are you a state resident[0] or not[1]: "); scanf("%i", &c0ch1); studentservicesfee=19; if(c0ch1==0) { enrollmentfee=46; } else if(c0ch1==1) { enrollmentfee=335; } printf("Want a parking decal? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { parkingfee=85; } else if(choice=='n' || choice=='N') { parkingfee=0; } printf("Want an AS sticker? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { stickerfee=19.5; studentservicesfee+=stickerfee; } else if(choice=='n' || choice=='N') { stickerfee=0; studentservicesfee+=stickerfee; } printf(" Want an ID card? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { idCardfee=13; studentservicesfee+=idCardfee; } else if(choice=='n' || choice=='N') { idCardfee=0; studentservicesfee+=idCardfee; } totalfee=total(enrollmentfee,parkingfee,studentservicesfee); printf("For Fall semester, your total fees are : %.2f ", totalfee); break; case 1:// for winter printf("Are you a state resident[0] or not[1]: "); scanf("%i", &c0ch1); studentservicesfee=16; if(c0ch1==0) { enrollmentfee=46; } else if(c0ch1==1) { enrollmentfee=335; } printf("Want a parking decal? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { parkingfee=45; } else if(choice=='n' || choice=='N') { parkingfee=0; } printf("Want an AS sticker? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { stickerfee=19.5; studentservicesfee+=stickerfee; } else if(choice=='n' || choice=='N') { stickerfee=0; studentservicesfee+=stickerfee; } printf(" Want an ID card? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { idCardfee=13; studentservicesfee+=idCardfee; } else if(choice=='n' || choice=='N') { idCardfee=0; studentservicesfee+=idCardfee; } totalfee=total(enrollmentfee,parkingfee,studentservicesfee); printf("For Fall semester, your total fees are : %.2f ", totalfee); break; case 2:// for spring printf("Are you a state resident[0] or not[1]: "); scanf("%i", &c0ch1); studentservicesfee=19; if(c0ch1==0) { enrollmentfee=46; } else if(c0ch1==1) { enrollmentfee=335; } printf("Want a parking decal? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { parkingfee=85; } else if(choice=='n' || choice=='N') { parkingfee=0; } printf("Want an AS sticker? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { stickerfee=19.5; studentservicesfee+=stickerfee; } else if(choice=='n' || choice=='N') { stickerfee=0; studentservicesfee+=stickerfee; } printf(" Want an ID card? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { idCardfee=13; studentservicesfee+=idCardfee; } else if(choice=='n' || choice=='N') { idCardfee=0; studentservicesfee+=idCardfee; } totalfee=total(enrollmentfee,parkingfee,studentservicesfee); printf("For Fall semester, your total fees are : %.2f ", totalfee); break; case 3:// for summer printf("Are you a state resident[0] or not[1]: "); scanf("%i", &c0ch1); studentservicesfee=16; if(c0ch1==0) { enrollmentfee=46; } else if(c0ch1==1) { enrollmentfee=335; } printf("Want a parking decal? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { parkingfee=45; } else if(choice=='n' || choice=='N') { parkingfee=0; } printf("Want an AS sticker? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { stickerfee=19.5; studentservicesfee+=stickerfee; } else if(choice=='n' || choice=='N') { stickerfee=0; studentservicesfee+=stickerfee; } printf(" Want an ID card? [y/n]: "); scanf(" %c", &choice); if(choice=='y' || choice=='Y') { idCardfee=13; studentservicesfee+=idCardfee; } else if(choice=='n' || choice=='N') { idCardfee=0; studentservicesfee+=idCardfee; } totalfee=total(enrollmentfee,parkingfee,studentservicesfee); printf("For Fall semester, your total fees are : %.2f ", totalfee); break; default: printf("please enter correct option "); } return 0; } float total(float enroll,float park,float service) { enroll=enroll*units; printf("%f %f %f ", enroll, park, service); return (enroll+park+service); }

Explanation / Answer

#include<> is to include the files from the library

but in this code you used #include float total(float,float,float); which doesnt make any sense

#Include<stdio.h>

float total(float,float,float); // use this