Simple C++ Work - Constructors

Completed Posted 7 years ago Paid on delivery
Completed Paid on delivery

Most of the code is already there, this is for educational purposes to compare with my own and learn. I do not expect to pay too much as this will be an easy job for you.

I will be providing all the files and instructions very easy for you.

Part of instructions:

Design and code a class named Passenger in the namespace holiday. The class represents passengers for an airline company that go on vacation. Add to the class the following private attributes:

m_name: an array of characters of size 32 (including '\0') that holds the name of the passenger;

m_destination: an array of characters of size 32 (including '\0') that holds the destination where the passenger is travelling;

m_departureYear, m_departureMonth, and m_departureDay: three integers that together represent the date when the passenger goes on vaca-tion;

The class Passenger has the following member function already implemented in [login to view URL] (look at this function and make sure you understand its imple-mentation):

void display(bool onlyNames = false) const: a query that displays the contents of a Passenger instance.

Add to the type Passenger the following member functions (and implement them—make sure to reuse existing code instead of duplicating it):

default constructor (a constructor with no parameters): this constructor should set the instance to the safe empty state (the safe empty state is when all numeric attributes are set to zero and the strings are set to the empty string);

constructor with 2 parameters: The first parameter contains the name of the passenger and the second parameter contains the destination of the journey. This constructor should set the m_name attribute to the first parameter, the m_destination attribute to the second parameter, and the departure date to July 1st, 2017. This constructor validates the parameters before accepting them; if the parameters are not valid (any of them), then this function should set the instance to the safe empty state.

- The strings are valid if they are not null and not empty;

bool isEmpty() const: a query that checks if the Passenger instance is in the safe empty state;

bool canTravelWith(const Passenger&) const: a query that checks if two passengers can travel together (two passengers can travel together if they go to the same destination on the same date).

C Programming C++ Programming

Project ID: #13096790

About the project

13 proposals Remote project Active 7 years ago

Awarded to:

blitz003

Hello. Lets talk about the price. I can do this for you in less than an hour if all things be equal. I can take as low as $5.00 if you're willing to work with me. I just want to help.

$20 CAD in 1 day
(2 Reviews)
0.2

13 freelancers are bidding on average $25 for this job

wangbeizou

Hello. How are you. I have read and understood the project. I'm an Expert in Data Structures and Algorithms. And I know well ; Java ,C/C++, Python ,PHP. I'm interested this project. So, firstly I want to discu More

$40 CAD in 1 day
(164 Reviews)
6.4
harshdaga

Hi, I've got quite some experience with C and C++ and I'm sure I can help you out with your project. This won't take more than a couple of hours to finish.

$25 CAD in 1 day
(83 Reviews)
5.5
kostasrim

Hello, my name is Kostas and I am an expert c/c++ developer with an extensive knowledge of algorithms and data structures. Please send me a message to discuss the project details. I can have your project ready by More

$25 CAD in 1 day
(27 Reviews)
4.4
ahmadshyk

hey i am new here as my profile shows but i am building my reputation and i can do your work as I bid to only those projects which i think i can complete, thanks :)

$15 CAD in 1 day
(3 Reviews)
3.0
achouriissam

Hello, My name is Achouri Issam. I have over three years experience in Software Engineering and i have a good Knowledge with Java, JavaEE,Android,IOS, Spring, Spring MVC, EJB,Struts2, Hibernate, JSP, Servlet , More

$16 CAD in 1 day
(3 Reviews)
2.0
CamelCaseAndrew

Can deliver quality code with clear instructions. I also have lots of experience in object oriented software development.

$20 CAD in 1 day
(0 Reviews)
0.0
nikoym

Dear Friend, I'd like to work on this task and I think this is a piece of cake! I'm new to this freelancing site but I'm quite experienced with programming and ecpecially with C++. I look forward to hearing from More

$15 CAD in 1 day
(0 Reviews)
0.0
Er1cHo

Hi there, I'm an experienced C++ programmer and I like to take this project and we can share what we knew :)

$23 CAD in 1 day
(0 Reviews)
0.0