Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need help with a c++ program for a mall i need to have seven classes and i don

ID: 3559792 • Letter: I

Question

i need help with a c++ program for a mall i need to have seven classes and i dont know how to start it please help me, some of the classes are. 1. customer, his is the user, name, money, age, employee, store. The user types in the info, ask if they are an employee and if so, which store. emoloyees get 40% off, 2. store, contains store name, an array of item names, prices, and quantities.,3. shopping reciept store name, receipt number, array of item names, array of item prices, array of item quantities, total, discount, tax, grandtotal. All receipts are saved in a text file, and can be brought back up by typing in the receipt number., 4.food court, contains restaurants, and an array of items on menu and prices. 5.atm, This is the basic atm machine where you ask for user name and pin. it will have a balance and you can withdraw money. 6.movie theater, movies that are showing, and their showtimes. 7. redboxes,  create a file to store all the movies, video games, and blue rays, how many checked out and such.

Explanation / Answer

redboxes class

class redboxes{
   public:
   void rentMovie(){
       string line;
       ifstream input;
       string movie_name, type, status, lender, date_of_issue, due_date; // data from file
       string movie, user; // data from user
       string contents;
      
       char c;

       cout << "Enter movie name > ";
       getline(cin, movie);

      
       input.open("movies.txt");
       while(input.is_open())
       {
           while (getline(input, line)) {
              
               istringstream strstream(line);
              
               getline(strstream, movie_name, ',');
               getline(strstream, type, ',');
               getline(strstream, status, ',');
               getline(strstream, lender, ',');
               getline(strstream, date_of_issue, ',');
               getline(strstream, due_date, ',');
              
               trim( movie_name );
               trim( type );
               trim( status );
               trim( lender );
               trim( date_of_issue );
               trim( due_date );

               strstream.clear();
              
               if( movie.compare(movie_name) == 0 ){
                       if(status.compare("available") == 0){
                       cout << "Movie is available for rent. Rent ? (y/n) " ;
                       cin >> c;
                       if(c == 'y'){
                           cout << "Enter user name > ";
                           cin >> user;
                           lender = user;
                          
                           time_t timer;
                           time(&timer);
                           struct tm *time = localtime(&timer);
                          
                           int day, mon, year;
                           if((time->tm_mday + 14) > 31){
                               day = 14 - (31-time->tm_mday);
                               mon = time->tm_mon + 2;
                               if(mon > 12){
                                   mon = mon-12;
                                   year = time->tm_year + 1900 + 1;
                               }else{
                                   year = time->tm_year + 1900;
                               }
                            }
                           else{
                           day = time->tm_mday + 14;
                           }
                           stringstream s1, s2, s3, s4, s5, s6;
                           string sday, smon, syear;
                           s1 << time->tm_mday;
                           sday = s1.str();  
                           s2 << (time->tm_mon + 1);
                           smon = s2.str();                          
                           s3 << (time->tm_year + 1900);
                           syear = s3.str();                          
                          
                           date_of_issue = sday + "-" + smon + "-" + syear;
                          
                           s4 << day;
                           sday = s4.str();                          
                           s5 << mon;
                           smon = s5.str();                          
                           s6 << year;
                           syear = s6.str();      
                           due_date = sday + "-" + smon + "-" + syear;
                          
                           status = "checked";
                          
                           cout << "Movie: " << movie_name <<    ", type: " << type << ", date of issue: " << date_of_issue << ", due date: " << due_date << endl;
                       }
                   }else if(status.compare("checked") == 0){
                       cout << "Enter user name > ";
                       cin >> user;
                       if(lender.compare(user) == 0){
                           cout << "Due date is : " << due_date << endl;
                       }
                       else{
                           cout << "Item not available" << endl;
                       }
                   }
               }
               string temp;
               temp = movie_name + "," + type + "," + status + "," + lender + "," + date_of_issue + "," + due_date + " ";
               contents+=temp;
           }
           input.close();
       }


       ofstream output;
       output.open("movies.txt");
       if(!output.is_open()){
           cout << " Could not open file. ";
           //exit(0);
       }else{
           output << contents;
           output.close();
       }
   }
  
   void rentGame(){
       string line;
       ifstream input;
       string game_name, status, lender, date_of_issue, due_date; // data from file
       string game, user; // data from user
       string contents;
      
       char c;

       cout << "Enter game name > ";
       getline(cin, game);
      
       input.open("games.txt");
       while(input.is_open())
       {
           while (getline(input, line)) {
              
               istringstream strstream(line);
              
               getline(strstream, game_name, ',');
               getline(strstream, status, ',');
               getline(strstream, lender, ',');
               getline(strstream, date_of_issue, ',');
               getline(strstream, due_date, ',');
              
               trim( game_name );
               trim( status );
               trim( lender );
               trim( date_of_issue );
               trim( due_date );

               strstream.clear();
              
               if( game.compare(game_name) == 0 ){
                       if(status.compare("available") == 0){
                       cout << "Game is available for rent. Rent ? (y/n) " ;
                       cin >> c;
                       if(c == 'y'){
                           cout << "Enter user name > ";
                           cin >> user;
                           lender = user;
                          
                           time_t timer;
                           time(&timer);
                           struct tm *time = localtime(&timer);
                          
                           int day, mon, year;
                           if((time->tm_mday + 14) > 31){
                               day = 14 - (31-time->tm_mday);
                               mon = time->tm_mon + 2;
                               if(mon > 12){
                                   mon = mon-12;
                                   year = time->tm_year + 1900 + 1;
                               }else{
                                   year = time->tm_year + 1900;
                               }
                            }
                           else{
                           day = time->tm_mday + 14;
                           }
                           stringstream s1, s2, s3, s4, s5, s6;
                           string sday, smon, syear;
                           s1 << time->tm_mday;
                           sday = s1.str();  
                           s2 << (time->tm_mon + 1);
                           smon = s2.str();                          
                           s3 << (time->tm_year + 1900);
                           syear = s3.str();                          
                          
                           date_of_issue = sday + "-" + smon + "-" + syear;
                          
                           s4 << day;
                           sday = s4.str();                          
                           s5 << mon;
                           smon = s5.str();                          
                           s6 << year;
                           syear = s6.str();      
                           due_date = sday + "-" + smon + "-" + syear;
                          
                           status = "checked";
                          
                           cout << "Game: " << game_name << ", date of issue: " << date_of_issue << ", due date: " << due_date << endl;
                       }
                   }else if(status.compare("checked") == 0){
                       cout << "Enter user name > ";
                       cin >> user;
                       if(lender.compare(user) == 0){
                           cout << "Due date is : " << due_date << endl;
                       }
                       else{
                           cout << "Item not available" << endl;
                       }
                   }
               }
               string temp;
               temp = game_name + "," + status + "," + lender + "," + date_of_issue + "," + due_date + " ";
               contents+=temp;
           }
           input.close();
       }


       ofstream output;
       output.open("games.txt");
       if(!output.is_open()){
           cout << " Could not open file. ";
           //exit(0);
       }else{
           output << contents;
           output.close();
       }
   }
  
   void trim(string& s)
{
size_t p = s.find_first_not_of(" ");
s.erase(0, p);

p = s.find_last_not_of(" ");
if (string::npos != p)
s.erase(p+1);
}  
  
};

Sample Data

movies.txt

The lord of the rings,Blueray,checked,Bob,12-4-2014,24-4-2014
The good the bad the ugly,Dvd,checked,Martin,18-4-2014,30-4-2014
Shawshank redemption,Dvd,available,NA,NA,NA
Hobbit,Blueray,checked,John,26-7-2014,9-8-2014

games.txt

Need for speed,checked,Bob,12-4-2014,24-4-2014
Counter Strike,checked,Martin,18-4-2014,30-4-2014
Project IGI,checked,John,26-7-2014,9-8-2014
Moto GP,available,NA,NA,NA