Vet Clinic Program??

I'm creating a program that will allow a receptionist at a veterinary clinic that services only dogs and cats to calculate the total bill for a customer. The program should start off by asking the receptionists for the name of the pet and if the animal is a dog or a cat. The program should then display an option menu to the receptionist. Each time an option is selected it adds the cost of the service to the total bill. The menu is displayed again until the user chooses to display the bill. I'm having trouble with the calculations. It isn't summing the services or displaying the total bill.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//VetClinicCode.cpp - Calculates total bill for servies
//Created/revised by <MCN29> on <12/3/10>

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main ()
{

	//function prototypes
	void getProgramName();
	void displayDogMenu();
	void displayCatMenu();
	

	//declare arrays
	int BATH_TYPE[3] = {1,2,3};
	double BATH_PRICE[3] = {30.00, 20.00, 15.00};


	//declare variables
	string name = " ";
	int animalType = 0;
    const int LARGE_DOG = 1;
	const int SMALL_DOG = 2;
	const int CAT = 3;
	int dogChoice = 0;
	int catChoice = 0;
	int sub = 0;
	double bathCat = 0;
	double totalBill = 0.0;
	double vetVisit = 0.0;
	double kennelService = 0.0;
	int numOfDays = 0;
	double totalKennel = 0.0;
	double bathDog = 0.0;
	double nailClipping = 0;
	const int SIZE = 3;

	//program name
	getProgramName();

	//get input from user
	cout << "Animal Name: ";
	getline(cin, name);
	cout << "Enter 1 for Cat or 2 for Dog: ";
	cin >> animalType;

	if (animalType == 1)
	{
		displayCatMenu();
		cout << "Enter 1, 2, 3, or 4: ";
		cin >> catChoice;
	} //end if

	while (catChoice > 0 && catChoice < 4)
	{
		if (catChoice == 1)
			bathCat = BATH_PRICE[sub];
			sub++;
			totalBill = totalBill + bathCat;


		if (catChoice == 2)
			vetVisit = 75.00;
			totalBill = totalBill + vetVisit;
	
		if (catChoice == 3)
			cout << "Enter Number of Days Kennel Service Was Used: ";
			cin >> numOfDays;
			totalKennel = (kennelService*numOfDays);
			totalBill = totalBill + totalKennel;
			

		if (catChoice == 4)
			cout << "Total Bill = " << totalBill << endl;
			

		//end if
		//get next menu choice

		displayCatMenu();
		cout << "Enter 1, 2, 3, or 4: ";
		cin >> catChoice;
	
	} //end while


	system("pause");
	return 0;
	} //end of main function

//*****function definitions*****
void getProgramName()
{
	cout << "Vet Clinic Program" << endl; 
} //end of getProgramName


void displayDogMenu()
{
	cout << "1 Bath: " << endl;
	cout << "2 Vet Visit: " << endl;
	cout << "3 Nail Clipping: " << endl;
	cout << "4 Kennel Serive: " << endl;
	cout << "5 Display Total Bill: " << endl;
}//end of displayDogMenu

void displayCatMenu()
{

	
	cout << "1 Bath: " << endl;
	cout << "2 Vet Visit: " << endl;
	cout << "3 Kennel Servie: " << endl;
	cout << "4 Display Total Bill: " << endl;

}//end displayCatMenu 



I haven't completed the dog choices yet.
Last edited on
1
2
3
4
5
while (catChoice > 0 && catChoice < 4){
//...
		if (catChoice == 4)//you could never be here
			cout << "Total Bill = " << totalBill << endl;
}

use curly braces {} to group statements (just indenting is not enough).

Your code could be clearer with enums
1
2
enum animal{cat, dog, camel, killer_whale};
enum option{bath, visit, kennel, nail_clipping, display};


Topic archived. No new replies allowed.