Creating a billing system

Hello, this is all new to me and i've been trying to do this for countless hours and would really appreciate any help. I have to create a program that will allow customers to select treatments and then calculate the total bill... Any help would be great.
I think I have to insert loops but I'm unsure on how to use them properly.

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
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <iomanip>
#include "float.h"
#include <stack>

using namespace std;

using std::stack;

int _tmain(int argc, _TCHAR* argv[])
{

	{
		char treatment_types, anymore_treatments, anymore_visits, treatment_type[15], answer/*, ftype, wtype, ctype, etype, rtype, itype*/;
		double levy = 15, fcharge, wcharge, ccharge, echarge, rcharge, icharge, cost, totalcost, totalincome;
		int quantity, noofpatients, total_qtyf, total_qtyw, total_qtyc, total_qtye, total_qtyr, total_qtyi;


		cout << "\n Enter treatment type (F,W,C,E,R,I) : ";
		cin >> treatment_types;
		cout << "\n Enter quantity of treatments : ";
		cin >> quantity;


		switch (treatment_types)
		{
		case 'F': fcharge = 27.50;
			cost = fcharge; break;
			cost = quantity*cost;
			totalcost = fcharge + cost;
			totalcost = quantity + total_qtyf;

		case 'W': wcharge = 40.00;
			cost = wcharge; break;
			cost = quantity*cost;
			totalcost = wcharge + cost;
			totalcost = quantity + total_qtyw;

		case 'C': ccharge = 210.00;
			cost = ccharge; break;
			cost = quantity*cost;
			totalcost = ccharge + cost;
			totalcost = quantity + total_qtyc;

		case 'E': echarge = 25.00;
			cost = echarge; break;
			cost = quantity*cost;
			totalcost = echarge + cost;
			totalcost = quantity + total_qtye;

		case 'R': rcharge = 145.00;
			cost = rcharge; break;
			cost = quantity*cost;
			totalcost = rcharge + cost;
			totalcost = quantity + total_qtyr;

		case 'I': icharge = 7.50;
			cost = icharge; break;
			cost = quantity*cost;
			totalcost = icharge + cost;
			totalcost = quantity + total_qtyi;
		}

		cout << "\n " << cost * quantity + 15;
		do
		{

			cout << "\n\n""Any more treatments [Y/N] :";
			cin >> answer;

			if (answer == 'Y')
			{
				cout << "\nEnter treatment type( F,W,C,E,R,I) : ";
				cin >> treatment_type;
				cout << "\nEnter Quantity : ";
				cin >> quantity;
				cout << "\n " << cost * quantity;
			}

			else (answer == 'N');

			cout << "Your bill is : " << cost << endl;

		} while (true);

		_getche();
		return 0;
	}
	return 0;
}
Last edited on
Topic archived. No new replies allowed.