repl.it
@SofhinWong1/

Testing for room assign

C

No description

fork
loading
Files
  • main.c
main.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#include <stdio.h>
#include<string.h>
#include<stdlib.h>

struct room{
  char name[10];
  char SID[10];
  char Gender[6];
  char type[30];
  int room;
};

int type,GDR;

void Room_Type(){
  printf("\n1 Single Room\n2 Double Bedded Room\n3 Triple Bedded Room\n4 Four Beeded Room\n5 Main Menu\nPlease enter your option: ");
  scanf("%i", &type);}

void Details(){
  printf("\n\n1 Male\n2 Female\nPlease enter your option: ");
  scanf("%i",&GDR);}

int main(){
  struct room rm[5]={0};
//variable for menu1
int menu,i=0,Laundry_rate=20;
//variables for A1
char *A1_Name=malloc(100);
char *A1_SID=malloc(100);
char *A1_Room=malloc(100);
int pay,I_week, L_week,R_week;
int A1_Internet, A1_Laundry, A1_Gym, A1_Meal,A1_total;
int A1_room_rate=400, A1_Internet_rate=40;
int no;

int I_total, room_total, L_total,total;
int room_no=0;

int check,x,TA,TO,go,choose;

/*for(int temp=0;temp<5;temp++){
  A1_Room[temp]=0;
  I_total=0;
  L_total=0;
  room_total=0;
  A1_total=0;}*/
  
  for(i=0;i<5;i++){
Main_Menu:
  printf("\n1 Room Booking\n2 Room Availability\n3 Payment Details\nPlease enter your option:");
  scanf("%i",&menu);

  if(menu==1)
  {
    Details();
    Room_Type();

//male+A1
    if(GDR==1 && type==1){
    number:
      printf("\nHow many weeks of room booking?\n");
      scanf("%i",&R_week);
      

      
      printf("\nName:");
      scanf("%s",rm[i].name);
      printf("Student ID:");
      scanf("%s",rm[i].SID);
      rm[i].room=rm[i].room+1;
      room_no=rm[i].room+room_no;
//       printf("Gender:Male\n");
//       printf("Type: Single Room\n");}

      printf("\n============== Room Details ===============\n");
      printf("Name\t\t: %s\nStudent ID\t: %s\n",rm[i].name,rm[i].SID);
      printf("Gender\t\t: Male");
      printf("\nRoom Number\t: %i\nType\t\t: Single Room",room_no);
      printf("\n============================================\n");
    
    
Internet1:
    printf("\nDo you want to subscribe for Internet?\n1 Yes\n2 No\nPlease enter your option:");
    scanf("%i",&A1_Internet);
    if(A1_Internet==1){
      printf("How many weeks of subscription?\n");
      scanf("%i",&I_week);
      goto Meal1;} 
    if(A1_Internet==2){
      goto Meal1;}
    else{
      goto Internet1;
    }

Meal1:
    printf("\nDo you want to subscribe for Meal?\n1 Yes\n2 No\nPlease enter your option:");
    scanf("%i",&A1_Meal);
    if(A1_Meal==1){
      printf("\nSorry, this service is not available for subscription. Thank you.\n");
      goto Laundry1;}
    if(A1_Meal ==2){
      goto Laundry1;}
    else{
      goto Meal1;}

Laundry1:
    printf("\nDo you want to subscribe for Laundry?\n1 Yes\n2 No\nPlease enter your option:");
    scanf("%i",&A1_Laundry);
    if(A1_Laundry==1){
      printf("How many weeks of subscription?\n");
      scanf("%i",&L_week);
      goto Gym1;}
    if(A1_Laundry==2){
      A1_Laundry=0;
      goto Gym1;}
    else{
      goto Laundry1;}
Gym1:
    printf("\nDo you want to subscribe for Gym?\n1 Yes\n2 No\nPlease enter your option:");
    scanf("%i",&A1_Gym);
    if(A1_Gym==1){
      printf("\nSorry, this service is not available for subscription. Thank you\n");
      goto Info1;}
    if(A1_Gym==2){
      goto Info1;}
    else{
      goto Gym1;}}
Info1:      
//        printf("\nPlease enter your name:");
//        scanf("%s", A1_Name);
//        printf("Please enter your Student ID:");
//        scanf("%s",A1_SID);
    room_total= A1_room_rate*R_week;
    L_total = Laundry_rate*L_week;
    I_total = A1_Internet_rate*I_week;
    total = room_total + I_total+L_total;
  
  Pay:
    printf("\n============== Payment Details ===============\n");
    printf("\nWeekly rate for the room\t: RM%i\n%i weeks of subscription\t\t: RM%i\nWeekly rate for the laundry\t: RM%i\n%i weeks of subscription\t\t: RM%i\nWeekly rate for the Internet: RM%i\n%i weeks of subscription\t\t: RM%i\n\nTotal amount payable is RM%i.\n",A1_room_rate, R_week, room_total, Laundry_rate,L_week,L_total,A1_Internet_rate,I_week,I_total,total);
    printf("==============================================\n");
    printf("\nDo you want to make payment now or later by cash?\n1 Now\n2 Cash\nPlease enter your option:");
    scanf("%i",&pay);
    if(pay==1){
      printf("\nPlease deposit your money in the slot provided.\nMaximum cash per deposit is 100 pieces of any combined denominations.\n");
      printf("Thank you for your payment.\n\n");
      continue;}
    if(pay==2){
      printf("Please proceed to counter 1. Payment must be made within 7 days. Thank you.\n\n");}
    else{
      goto Pay;
      break;}}
//menu 2 :check availability
//variable for menu 2
  if(menu==2){
M2:
    printf("\n1 Check by type\n2 Check by gender\n3 Main Menu\nPlease enter your option:");
    scanf("%i",&check);
    if(check==1 || check==2){
      Room_Type();
      if(choose==1){
        for(i=0;i<5;i++){
          x=rm[i].room;
          if(x==0){
            TA=TA+1;}
          if(x==1){
            TO=TO+1;}}
        printf("Available single room for male is %i",TA);
        printf("sad");}
      if(choose==2){
        printf("Double Bedded Room is not ready for both male and female yet.\n");}
    }}
  }
}
Fetching token
?