I'm currently having a problem with having where it says DailyChild on my code to go up when the user adds a number. For example if they type 1 it should say 1.50. If they enter 2, it should say 3.00. But no matter what I do, it keeps printing coming up to 1.50. Can someone show me what I'm doing wrong please, really in a jam on trying to get this to work. Also may someone be able to tell me why when I compile my program it shows no errors but when I'm bout to exit the program it says theres an error. You'll notice it when you enter in the code. Also if you notice any other problems with my code, please let me know. Thanks for the help, I'm patiently hoping for a reply soon!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
void PrintAStarLine(void);
void GetInput(void);
void GetTicket(void);
void HowManyChildren(void);
void HowManyAdults(void);
void HowManySeniors(void);
void ChildrenCalculations(void);
float DailyChild;
float YearlyChild;
float DailyAdult;
float YearlyAdult;
float DailySenior;
float YearlySenior;
char customerName[30];
char tickettype[8];
int childrenNum;
int adultNum;
int seniorNum;
main()
{
{
PrintAStarLine();
printf(" Home Aquarium Data Entry \n");
printf("\n\n");
PrintAStarLine();
GetInput();
}
GetTicket();
return 0;
}
void PrintAStarLine(void)
{
printf("**************************************************************************** \n");
printf("\n\n");
return;
}
void GetInput(void)
{
printf("Customer Name (First Middle Last): ");
scanf(" %s %s %s", &customerName);
printf("\n\n\n");
return;
}
void GetTicket(void)
{
printf("Type of ticket (Daily(D) or Yearly(Y)): ");
scanf(" %s", &tickettype);
if (strcmp (tickettype,"D") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", DailyChild);
printf("Adult total cost: %10.2f\n", DailyAdult);
printf("Senior total cost: %10.2f\n", DailySenior);
}
else if (strcmp (tickettype,"d") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", DailyChild);
printf("Adult total cost: %10.2f\n", DailyAdult);
printf("Senior total cost: %10.2f\n", DailySenior);
}
else if (strcmp (tickettype,"Daily") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", DailyChild);
printf("Adult total cost: %10.2f\n", DailyAdult);
printf("Senior total cost: %10.2f\n", DailySenior);
}
else if (strcmp (tickettype,"daily") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", DailyChild);
printf("Adult total cost: %10.2f\n", DailyAdult);
printf("Senior total cost: %10.2f\n", DailySenior);
}
else if (strcmp (tickettype,"Y") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", YearlyChild);
printf("Adult total cost: %10.2f\n", YearlyAdult);
printf("Senior total cost: %10.2f\n", YearlySenior);
}
else if (strcmp (tickettype, "y") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", YearlyChild);
printf("Adult total cost: %10.2f\n", YearlyAdult);
printf("Senior total cost: %10.2f\n", YearlySenior);
}
else if (strcmp (tickettype,"Yearly") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", YearlyChild);
printf("Adult total cost: %10.2f\n", YearlyAdult);
printf("Senior total cost: %10.2f\n", YearlySenior);
}
else if (strcmp (tickettype,"yearly") == 0)
{
HowManyChildren();
HowManyAdults();
HowManySeniors();
printf("Children total cost: %10.2f\n", YearlyChild);
printf("Adult total cost: %10.2f\n", YearlyAdult);
printf("Senior total cost: %10.2f\n", YearlySenior);
}
else
{
printf("\nIncorrect Input, please try again.\n");
printf("\n\n\n");
GetTicket();
}
printf("\n\n");
return;
}
void HowManyChildren(void)
{
DailyChild=1.50;
YearlyChild = 5.50;
printf("\n");
printf("#of Children: ");
scanf(" %d", &childrenNum);
printf("\n");
if (childrenNum <= 999)
{
}
else
{
printf("Invalid Number Entered, please try again.");
printf("\n\n\n");
HowManyChildren();
}
return;
}
void HowManyAdults(void)
{
DailyAdult = 2.00;
YearlyAdult = 6.50;
printf("\n");
printf("#of Adults: ");
scanf(" %d", &adultNum);
printf("\n");
if (adultNum <= 999)
{
}
else
{
printf("Invalid Number Entered, please try again.");
printf("\n\n\n");
HowManyAdults();
}
return;
}
void HowManySeniors(void)
{
DailySenior = 1.25;
YearlySenior= 3.75;
printf("\n");
printf("#of Seniors: ");
scanf(" %d", &seniorNum);
printf("\n");
if (seniorNum <= 999)
{
}
else
{
printf("Invalid Number Entered, please try again.");
printf("\n\n\n");
system("pause");
HowManySeniors();
}
return ;
}
void ChildrenCalculations(void)
{
return;
}