-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfish_seller.c
61 lines (53 loc) · 1.81 KB
/
fish_seller.c
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
#include<stdio.h>
int main(){
float kg,total=0,Ttotal=0;
int fish[4]={0,0,0,0},Afish[4]={0,0,0,0},menu;
int customer=0,end1,end2;
do{
printf("Hello customer #%d , what would you like ? : ",customer+1);
customer++;
do{
printf("Type of fish :\n");
printf(" 0.8 - 1.0 kg 150 Baht\n");
printf(" 1.0 - 1.5 kg 200 Baht\n");
printf(" 1.5 - 2.0 kg 250 Baht\n");
printf(" 3.0+ kg 300 Baht\n");
printf("0. calculate money\n");
printf("Enter fish's weight : ");
scanf("%f",&kg);
if((kg>=8/10)&&(kg<1)){
fish[0]++;
Afish[0]=kg*150;
}
else
if((kg>=1)&&(kg<15/10)){
fish[1]++;
Afish[1]=kg*200;
}
else
if((kg>=15/10)&&(kg<2)){
fish[2]++;
Afish[2]=kg*250;
}
else
if(kg>=3){
fish[3]++;
Afish[3]=kg*300;
}
else
if(menu==0)
break;
else
printf("== ERROR == ");
printf("Do you want more ? (1 for yes): ");
scanf("%d",&end1);
}while(end1==1);
printf("ORDER #%d :\n");
printf("Type 1 have %d : %.2f Baht",fish[0],Afish[0]);
printf("Type 2 have %d : %.2f Baht",fish[1],Afish[1]);
printf("Type 3 have %d : %.2f Baht",fish[2],Afish[2]);
printf("Type 4 have %d : %.2f Baht",fish[3],Afish[3]);
}while(end2==1);
printf("END");
return 0;
}