// newproject2.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
usingnamespace std;
class userMenu{
public:
userMenu();
string homeMenu;
string add;
string remove;
string edit;
}; //webUser menu class
userMenu::userMenu(){
cout<<"Select an option below (1,2,3)"<<endl
<<"1. Add Booking"<<endl
<<"2. Edit Booking"<<endl
<<"3. Remove Booking"<<endl;
};
class addBooking{
public:
addBooking();
string addMenu;
string bookName;
int startDate;
int currentDate;
int lengthStay;
}; //add booking class
addBooking::addBooking(){
cout<<"Welcome to the Add Booking Menu!:"<<endl;
}; //contructor
class rates{
public:
rates();
int displayMonthRates();
int displayWeekRates();
int displayDayRates();
int monthRate;
int weekRate;
int dayRate;
};
rates::rates(){
dayRate=100;
weekRate=525;
monthRate=1575;
};
class newUser{ //new user class
public:
newUser();
string name;
string password;
};
newUser::newUser(){ //new user constrctor
};
int main(){
ofstream reservationFile; //creating output stream file to write reservation input
reservationFile.open("reservationLog.txt");
if(reservationFile.fail()){
cout<<"File reservation unsuccessfully opened."<<endl
<<"Please check to see if file exists."<<endl;
exit(1);
}
ofstream userFile; //create output stream file to write user login input
userFile.open("userinfo.txt.");
if(userFile.fail()){
cout<<"File userinfo unsuccessfully opened."<<endl
<<"Please check to see if file exists."<<endl;
exit(1);
}
cout<<"\n the file userinfo.txt has been successfully opened for writing."<<endl;
ifstream reservationFile;
reservationFile.open("reservation.txt");
if(reservationFile.fail()){
cout<<"File cannot be opened."<<endl
<<"Please check to see if File exists."<<endl;
}
cout<<"\n the file reservation.txt has been successfully opened for writing."<<endl;
cout<<"Welcome new user!:"<<endl;
int add=1;
int edit=2;
int remove=3;
newUser newUserOne;
int opselect;
cout<<"Please enter user name:"<<endl; //enter username
userFile<<newUserOne.name; //write username to userFile
cout<<endl;
cout<<"Please enter passworrd:"<<endl; //enter password
userFile<<newUserOne.password; //write password to user file
userMenu menuOne;
do{
cout<<menuOne.homeMenu<<endl; //display menu
cin>>opselect;
switch(opselect){ //switch statement to help with menu selection
case 1:{ //selected add bookin menu
cout<<"If Booked 2 weeks in advanced, 3% off lodging only"<<endl;
addBooking addMenu;
cout<<"Please enter book name:"<<endl; //enter book name
reservationFile<<addMenu.bookName; //write book name to reservationFile file
cout<<endl<<"please enter toady's date(yyyymmdd):"<<endl; //enter current date
reservationFile<<addMenu.currentDate; //write current date to reservationfile
cout<<endl<<"please enter start date:(yyyymmdd)"<<endl; //enter start date
reservationFile<<addMenu.startDate; //write start date to reservationfile
rates showRate;
cout<<"Monthly Rate:"<<showRate.monthRate<<endl //display month rate
<<"Weekly Rate:"<<showRate.weekRate<<endl //display week rate
<<"Daily Rate:"<<showRate.dayRate<<endl; //display day rate
cout<<"Please enter length of stay:"<<endl; //enter length of stay
reservationFile<<addMenu.lengthStay; //write length of stay to reservation file
cout<<addMenu.lengthStay/30<<"Months"<<endl //use algorithm to find out # of months,weeks, and days
<<addMenu.lengthStay%30/7<<"Weeks"<<endl
<<addMenu.lengthStay%30%7<<"Days"<<endl;
}
break;
case 2:{ //case to to edit book menu
cout<<"Welcome to the edit booking menu!"<<endl;
}
break;
case 3:{
cout<<"welcome to the remove booking menu!:"<<endl;
break;
}
}}
while(opselect==1&& opselect==2&& opselect==3); //while loop (may be wrong) to loop back to start of menu (may need help editting it
return 0;
}