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

I need help making a helicopter simulator program in C++. The instructions are:

ID: 3670771 • Letter: I

Question

I need help making a helicopter simulator program in C++. The instructions are:

Keywords: Overload, method, constructor/destructor, class, struct, pointer, dynamic memory allocation, string manipulation, vector, read/write file

Implement a helicopter simulator:

1) create a class helicopter containing the public method API; API calls the private methods: weather_input, fly_helicopter; (2 points)

2) The local pointer variable *myHelicopter defined as “struct flying_data” declared in the method API; myHelicopter requires struct dynamic allocation to match what user informs about how many helicopters are flying: 2 or 3; This struct contains: pilot_name, rockets, visibility; declare rockets as a type of variable “vector” of integer containing 4 rockets, 1 is loaded or 0 is empty/discharged. (3 points)

3) Method weather_input: read from a file what is the current visibility – if below 60% abort for safety reasons; also ask how many bars of fuel the helicopter has: 10 bars meaning 100%, 5 bars is 50% and so on; if fuel has only 10% of fuel it is not safe to fly.(2 points)

4) Use pointers to pass myHelicopter among the functions that are called from API. From fly_helicopter: print into a file on every loop iteration the fuel level; the name of the file for the output should be the pilot name; every loop decreases 3% from current tank level; (3 points)

Explanation / Answer

helicopter simulator

#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>

#include <string>
#include <vector> // Use these constants for your arrays.
const int MAX_ROWS = 100;
const int MAX_WIDTH = 100;
// Side of an helicopter , port or starboard. These terms are more
// precise than "left" and "right," which vary depending on whether
// you're facing forward or backward.
enum Side {
NotStowed = -1,
Port,
Starboard
};
class Passenger;
// TODO: From here on, you need to implement all of the member functions and
// add all of the member variables.

// --------------------------------------------------------------------------
// Represents a carryon bag owned by a passenger.
// Each bag has a single owner.

class Bag {
public:
// Owner is a pointer to a Passenger object. A bag is
// initialized not "stowed," meaning that it hasn't been
// stored in an overhead bin.
Bag(const Passenger* owner) {
assert(owner);
}


const Passenger* owner() const {
return nullptr;
}
// Return true if the bag is stowed.
bool is_stowed() const {
return false;
}
// Stow the bag at the given bin location.
void stow(Side side, int row)
{
assert(side != Side::NotStowed);
assert(row >= 0);
assert(row < MAX_ROWS); }
// Getters for the stow location.
Side side() const { return Side::NotStowed; }
int row() const { return -1; }
private:
// TODO add member variables here.
};
// Represents one passenger, who may or may not have one carryon bag.
class Passenger {
public:
// Create a passenger. id is a unique number which must be
// positive. row and seat designate a seat location, which each must
// also be positive. The passenger is created with no bags.
//
// Row and seat are a zero based indices.

Passenger(int id, int row, int seat) {}

// getters

int id() const { return -1; }

int row() const { return -1; }

int seat() const { return -1; }

// Create a bag and assign it to this passenger.

void bring_carryon() {}

// Returns nullptr if passenger has no bags.

Bag* carryon() { return nullptr; }

private:

// TODO add member variables here.

};

// Represents a model of helicopter , use static arrays to store the Passengers and

// their carryons.

class helicopter {

public:

// Initialize an helicopter with a given number of rows of seats, and

// width (number of passengers per row). Each argument must be

// positive.

helicopter (int rows, int width) {

assert(rows >= 0);

assert(rows < MAX_ROWS);

assert(width >=0 );

assert(width < MAX_WIDTH);

// TODO: code that initializes the helicopter to an empty state.

}

int rows() const { return -1; }

int width() const { return -1; }

/*

Prints out the passenger seating in a table.

Each column is separated by a single space.

The first column is 3 characters wide and displays the row number.

The following columns are 6 characters wide and display the Seat numbers.

The first line has the title of the printout "Seats"

The second line are the column titles "Row Seat 1 Seat 2 Seat 3 Seat 4 Seat N".

Empty seats display '------'.

This is what a printout for an helicopter with 10 rows, 4 wide, 36 passengers

looks like:

Seats

Row Seat 1 Seat 2 Seat 3 Seat 4

1 1 2 3 4

2 5 6 7 8

3 9 10 11 12

4 13 14 15 16

5 17 18 19 20

6 21 22 23 24

7 25 26 27 28

8 29 30 31 32

9 33 34 35 36

10 ------ ------ ------ ------

Please follow these instructions to make yours look just like this,

it'll make grading a lot easier for me.
*/

void PrintSeats() const {}

/* Follow similar rules to above, print out the overhead bin configuration:

Overhead Bins

Row Port Starboard

1 27 32

2 30 17

3 22 19

4 [ ] [ ]

5 [ ] [ ]

6 [ ] [ ]

7 [ ] [ ]

8 [ ] [ ]

9 [ ] [ ]

10 [ ] [ ]

*/

void PrintOverheadBins() const {}

// Attempt to place a passenger's carryon bag in an overhead bin.

// Returns true if successful (or the passenger had no bag),

// false if there was a problem sotwing a bag.

//

// If the passenger has a carryon, try to find a location for it using the following

// algorithm:

// Try row 1 port side; if full,

// try row 1 starboard side; if full,

// try row 2 port side; if full,

// try row 2 starboard side; if full,

// try row 3 port side; etc.

//

// The bag is stored in the plane's bin 2D array and

// the carryon's stow() function is called to record where the bag is.

bool place_carryon(Passenger* p) {

assert(p);

// No spot found.

return false;

}

// Seat the passenger at the correct row and seat.

bool seat_passenger(Passenger* p) {

assert(p);

assert(p->row() >= 0);

assert(p->row() < rows());

assert(p->seat() >= 0);

assert(p->seat() < width());

return false;

}

private:

// TODO add your member variables here.

};

3)Given a 50% probability of favorable aerial refueling weather for an overseas training deployment of fighters Tactical Air Command most likely delay the mission, or look for a with a higher probability of favorable weather. In the event of a contingency, however, a threshold as low as 20% may trigger a "go" decision.

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