-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDAIRYCALC(C++).cpp
70 lines (69 loc) · 1.51 KB
/
DAIRYCALC(C++).cpp
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
#include <iostream>
using namespace std;
int main()
{
int choice, choice2, n, i;
float fr, fp;
cout << "\n########### DAIRY CALCULATOR ###########";
cout << "\n\n Fat rate is 6 and Bonus is 4 per Kg\n";
while (2)
{
float sum = 0;
cout << "\nEnter the choice:\n";
cout << "1.Update Fat rate and Bonus\n";
cout << "2.Skip and proceed to Calculations\n";
cin >> choice;
switch (choice)
{
case 1:
{
cout << "Enter Fat rate and Bonus:";
cin >> fr >> fp;
cout << "Fat rate and Bonus updated successfully\n";
cout << "Press 1 for proceed to Calculations\nPress 2 for Exit\n";
cin >> choice2;
switch (choice2)
{
case 1:
{
cout << "Enter number of innings\n";
cin >> n;
float wt[n], fat[n];
cout << "Enter Milk weight and Fat for " << n << " days\n";
for (i = 0; i < n; i++)
{
cin >> wt[i] >> fat[i];
sum += (fat[i] * fr + fp) * wt[i];
}
cout << "Total amount for " << n << " days is Rs " << sum << "/-\n\n\n";
break;
}
case 2:
{
break;
}
}
break;
}
case 2:
{
cout << "Enter number of innings\n";
cin >> n;
float wt[n], fat[n];
cout << "Enter Milk weight and Fat for " << n << " days\n";
for (i = 0; i < n; i++)
{
cin >> wt[i] >> fat[i];
sum += (fat[i] * 6 + 4) * wt[i];
}
cout << "Total amount for " << n << " days is Rs " << sum << "/-\n\n\n";
break;
}
default:
{
cout << "Invalid choice!";
break;
}
}
}
}