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

Problem 1 (40 points)-Write a program. Submit a file named height.c Amusement pa

ID: 3907318 • Letter: P

Question

Problem 1 (40 points)-Write a program. Submit a file named height.c Amusement parks have minimum heights for their rides. Create a program that adds users to the line of a ride in an amusement park if they meet the minimum height requirement (given in inches) . Create three classes: o An amusement park class o A ride class o Arider class (people riding the rides) It should work with the following main (DO NOT MODIFY-NO CREDIT IF YOU MODIFY): int mainO Rider r1(Yaris", 45); //name, height in inches Rider r2(49)://height in inches Amusement park a1(3); //3 is the number of rides in the amusement park a1.get ride(1).add_line(r1); //add a rider to the line of a ride Amusement park a2(2); //2 is the number of rides in the amusement park a2.get ride(1).add line(r2); //add a rider to the line of a ride return 0; Possible Sample Run 1 (vour program does not have to match the following exactlv, but ~~~Amusement Park into~~~ Ride 1- Enter minimum ride height and ride name: 40 ride1 Ride 2- Enter minimum ride height and ride name 50 ride2 Ride 3- Enter minimum ride height and ride name 60 ride3 Adding rider to line Amusement Park Info Ride 1- Enter minimum ride height and ride name: 75 ride1 Ride 2- Enter minimum ride height and ride name: 76 ride2 Sorry can't add rider-too short.

Explanation / Answer

#define mnimumheight 30

class Rider{

    private:
       string name;
       int height;
    public:
       Rider(string n, int h){
          name = n;
          height = h;
       }
       Rider(int h){
          name = "";
          height = h;
       }
       string getName(){
          return name;
       }
       int getHeight(){
           return height;
       }
       void setName(string a){
           name = a;
       }
       void setHeight(int a){
           height = a;
       }
      
};

class Ride {
     private:
        Rider line[100];
        int num;
        int height;
       
     public:
        Ride(){
          
           num = 0;
          
        }
        void setHeight(int h){
            height = h;
        }
        add_line(Rider a){
           if (a.getHeight() >=height){
              line[num].setName(a.getName());
              line[num].setHeight(a.getHeight());
              num++;
           }
           else {
              cout << "Can not as height requirement is not met ";
           }
        }
}

class Amusement_part {
    private:
       Ride *data;
    public:
       Amusement_park(int a){
           data = new Ride[a];
           cout << "-----Amusement Park info----------- ";
           for (int i = 0; i<a; i++){
              cout << "Enter minimum height for ride " << i+1 << ":";
              int h;
              cin >> h;
              data[i].setHeight(h);
           }
       }
       
       Ride get_ride(int a){
          return data[a-1];
       }
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote