Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 399 Weeks Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 15 Sep 2017 My Price 10.00

code is legal

Given the following program. The code is legal except for one or more of main's cout statements. For each cout statement, specify whether it is legal or a compile error.



#include <iostream>
using namespace std;

class Employee
{
public:
    int id;
    Employee()
      {id=101; age=50; salary=30000.0;}

protected:
    int age;
private:
    float salary;
};

class HRWeasel : public Employee
{
// dummy class
};

class CopyGuy : private Employee
{
// dummy class
};

int main()
{
HRWeasel simone;
cout << simone.id;
cout << simone.age;
cout << simone.salary;

CopyGuy achmed;
cout << achmed.id;
cout << achmed.age;
cout << achmed.salary;

return 0;
}

Given the below car.h header file. Add preprocessor code to prevent programs from loading car.h's contents more than once. Use proper style. Show where your added code should be inserted.

#include <iostream>
using namespace std;
class Car
{
public:
    void setModel(char model[]);
    char* getModel();
private:
    char model[];
};

During this off season, Peter Cottontail has decided to convert the software in his egg distribution centers to C++. As you may know, bunnies have a hard time with OOP concepts and Peter is no exception to this rule. Consequently, he has asked you, his good friend, to help him out.

Write a complete C++ program that includes a class definition for a class named Eggs. The Eggs class should be written such that the below main function driver would produce the below output. As always, make sure that your output mimics the format of the sample output precisely. In your program, it's OK to write "<main function>" (in the appropriate place) instead of copying the below code.

The eggs class must contain an appropriate data member or data members. Write constructor definition(s), if necessary. Write member function definitions for display and smash. Write an overloaded operator definition for + (addition of two Eggs objects).

Note:
A????1 As always, for every member function and overloaded operator, use the appropriate access modifier A????1 const, static, or nothing.
A????1 As always, for every parameter, declare it appropriately using pass-by-value, pass-by-reference, and/or const.
A????1 As always, you must use precise syntax and proper style. Comments are not required.
A????1 I recommend that you write your program on a separate sheet of paper so that you have plenty of room.



int main()
{
   Eggs eggs1, eggs2;
   Eggs eggs3(13), eggs4(30);
   eggs1 = eggs2 + eggs3 + eggs4;
   eggs1.smash(1).smash(2);
   eggs1.display();
   eggs3.display();
   return 0;
}

output
3 dozen, 4 single(s)
1 dozen, 1 single(s)

1500 Extra creadit Will be given

Answers

(5)
Status NEW Posted 15 Sep 2017 01:09 PM My Price 10.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)