-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBilling_System.cpp
More file actions
47 lines (37 loc) · 1.13 KB
/
Billing_System.cpp
File metadata and controls
47 lines (37 loc) · 1.13 KB
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
/*PROBLEM
Billing System — Calculate Total Invoice Amount
A software company is developing a small billing module for a shop.
Write functions to:
1. Accept item price and quantity
2. Compute gross total
3. Apply 5% sales tax
4. Return final invoice amount
Requirement:
Create separate functions for gross total, tax calculation, and final bill calculation.
Demonstrate how these functions work together in the main program.*/
#include <iostream>
using namespace std;
int gross_total(int price, int quantity)
{
int total = price * quantity;
return total;
}
int final_price(int gross_total, int sales_tax)
{
int final_amt = gross_total - (gross_total * sales_tax / 100);
return final_amt;
}
int main()
{
int price, quantity;
int sales_tax = 5;
cout << "Enter the item price: ";
cin >> price;
cout << "Enter the item quantity: ";
cin >> quantity;
int total = gross_total(price, quantity);
int final_amt = final_price(total, sales_tax);
cout << "Gross Total: " << total << endl;
cout << "Final Price after " << final_amt << endl;
return 0;
}