PROBLEM WITH PAYMENT METHODS

need to create a motel room reservation that will show payment method options which includes cash, credit card and bank deposit. i'm sorry i'm so new to this and only know basic codes. i couldn't finish it because i don't know how the payment method works. i hope someone could help. thank you so much in advance.

will be posting my codes in a while.
Last edited on
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
175
176
177
178
179
180
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
 
struct Date{
   int month;
   int day;
   int year;
 };
 
typedef struct Date Date;
 
struct Room{
     
     char urchoice[6],fname[20],lname[20],address[30],email[20],fon[15];
     Date reserved;
     Date vacate;
     struct Room *next;
 };
 
typedef struct Room *rent;
rent top=NULL;
FILE *fp;
 
 //Save entries to the text file
void Save(){
 
     fp = fopen("dsafinals.txt", "w");
     rent save = top;
     
     while (save!=NULL){
          if (save->next==NULL)
              fprintf(fp,"%s %s \n%s \n%s \n%s \n%s %i %i %i \n%i %i %i",save->fname, save->lname, save->address, save->email, save->fon, save->urchoice, save->reserved.month, save->reserved.day, save->reserved.year, save->vacate.month, save->vacate.day, save->vacate.year);
          else
              fprintf(fp,"%s %s \n%s \n%s \n%s \n%s %i %i %i \n%i %i %i",save->fname, save->lname, save->address, save->email, save->fon, save->urchoice, save->reserved.month, save->reserved.day, save->reserved.year, save->vacate.month, save->vacate.day, save->vacate.year);
              save=save->next;
     }
     fclose(fp);
 }
 
 //Add entries to the list
void addRent(rent room){
 
     if (top==NULL)
          top=room;
          
     else{
          rent last=top;
          while (last->next!=NULL)
            last=last->next;
            last->next=room;
     }
 }
 
 //Load records from files
 void loadRent(){
 
     fp=fopen("dsafinals.txt", "r");
        
        while (!feof(fp)){
          rent room=(rent) malloc (sizeof(struct Room));
          fscanf(fp, "%s %i %i %i %i %i %i",  &room->urchoice, &room->reserved.month, &room->reserved.day, &room->vacate.year, &room->vacate.month, &room->vacate.day, &room->vacate.year);
          room->next=NULL;
          if (room->reserved.month>12||room->reserved.month<1)break;
          addRent(room);
        }    
 } 

 //Add rooms to list
 void Reserve(){
 int pi, rchoice, attempt=0;
 char yes, choice;
      
      rent room=(rent) malloc (sizeof(struct Room));
      
      printf("\n\n\ LIST OF ROOMS AVAILABLE:\n\n");
      printf(" STANDARD ROOM (Rm101-Rm104): \n Double sized bed \n Toilet with Shower \n TV w/ cable\n\n");
      printf(" DELUXE ROOM (Rm201-Rm204): \n Queen sized bed \n Toilet with bath tub \n Flat screen TV with cable\n\n");
      printf(" SUITE (Rm301-Rm304): \n King sized bed \n Toilet with shower and jacuzzi \n 40 inch flat screen TV with cable \n DVD player \n With balcony\n\n");
      
      printf("\n\n DO YOU WANT TO RESERVE A ROOM? [Y/N]: ");
      scanf("%s",&yes);
      system("cls");
  
  
  if(yes=='y' || yes=='Y'){
          printf("\n\n Press \"S\" for STANDARD ROOM(s)\n Press \"D\" for DELUXE ROOM(s)\n Press \"S\" for SUITE(s) ");
          printf("\n\n What rooms do you want to reserve? ");
          scanf("%s",&choice); system("cls");
          }
           
           
          if(choice=='S' || choice =='s' || choice =='D' || choice=='d' || choice=='S' || choice=='s'){
               printf("\n\n");
               printf(" Available Rooms: \n");
                
               do{
               printf(" For Standard Room  \"101-104\" \n For Deluxe Room  \"201-204\" \n For Suite Room  \"301-304\" \n\n Select \"Room Number From Above\" to reserve: ");
               scanf("%s",&room->urchoice);
               
               if(top==NULL){
                     printf(" Are you sure you want to reserve this room? [Y/N]: ");
                     scanf("%s",&yes);
                     
                                  if(yes=='y' || yes=='Y'){
                     printf(" OKAY! To reserve this \"Rm%s\"\n",&room->urchoice);
                     
                     printf("\n Fill out the following information (use underscore ( _ ) as white space)\n");
                     printf(" Firstname: ");
                     scanf("%s",&room->fname);
                     printf(" Lastname: ");
                     scanf("%s",&room->lname);
                     printf(" Address: ");
                     scanf("%s",&room->address);
                     printf(" Email: ");
                     scanf("%s",&room->email);
                     printf(" Contact #: ");
                     scanf("%s",&room->fon);
                     printf(" Reserve Date (mm dd yyyy): ");
                     scanf("%i%i%i",&room->reserved.month, &room->reserved.day, &room->reserved.year);
                     printf(" Check Out (mm dd yyyy): ");
                     scanf("%i%i%i",&room->vacate.month, &room->vacate.day, &room->vacate.year);
                                    
                                    printf("\n Do you want to \"CONFIRM\" your reservation? [Y/N]: ");
                                    scanf("%s",&yes);
                                    system("cls");
                                                  if(yes=='y' || yes=='Y'){
                                                  printf("\n\n");
                                                  for(pi=10;pi<89;pi++) printf("*");
                                                  printf("\n\n\t\t\t ** iRESERVE: MOTEL RESERVATION  **");
                                                  printf("\t\t\t\t\t     \" Book your room in the comfort of your home... \"\n\n");
                                                  printf(" Room is successfully reserved :) \n");
                                                  printf(" Fullname: %s %s\n",room->fname,room->lname);
                                                  printf(" Address: %s\n",room->address);
                                                  printf(" Email: %s\n",room->email);
                                                  printf(" Contact #: %s\n",room->fon);
                                                  printf(" Your reserved room is %s \n on %i%i%i to %i%i%i\n\n",room->urchoice, room->reserved.month, room->reserved.day, room->reserved.year, room->vacate.month, room->vacate.day, room->vacate.year);
                                                  printf(" Please \"SAVE\" this transaction. \n Thank you and have a nice day :) \n\n");
                                                  for(pi=10;pi<89;pi++) printf("*");printf("\n");
                                                  system("pause");system("cls");
                                                  }
                                                            else{
                                                            printf("\n\n");
                                                            for(pi=10;pi<89;pi++) printf("*");
                                                            printf("\n\n");
                                                            printf("\t\t Thank you and have a nice day :)...\n\n");
                                                            for(pi=10;pi<89;pi++) printf("*");printf("\n\n");
                                                            }
                                                            }
                                                            
                                   
                                   else{
                                        system("cls");
                                        }
                    
               break;
               }
                     
               else{
               attempt++;
               }
               if(attempt==3){
               printf("\n\n\n");
               for(pi=10;pi<89;pi++) printf("*");
               printf("\n\n");
               printf("\t\t Thank you for doing business with us.. Until your next reservation..");
               printf("\n\n");
               for(pi=10;pi<89;pi++) printf("*");printf("\n\n\n");
               }
               }while (attempt<=2);
               }    
      
      room->next=NULL;
      addRent(room);
 }
 



Topic archived. No new replies allowed.