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

The class Actor represents a thespian who reads lines and plays parts in a play,

ID: 3800595 • Letter: T

Question

The class Actor represents a thespian who reads lines and plays parts in a play, movie or musical. Consider the following diagram:

Actor with 1 Academy Award, 0 Emmy Awards

Actor with 0 Academy Awards, 0 Emmy Awards


Each Actor defines its own name and tracks its number of academy and emmy awards.
For the constructor shown above, here is the class definition (.h)

Actor( string n, int academyAwards=0, int emmyAwards=0 );

string getName( ) const;
int getAcademy( ) const;
int getEmmy( ) const;

void act( std::string lines ) const;

std::string name; // name of the actor
int academy, emmy; // the number of awards won

Actor( std::string n, int academy=0, int emmy=0 );

std::string getName( ) const;
int getAcademy( ) const;

int getEmmy( ) const;

void act( std::string lines ) const;

int academyAward, emmyAward;
std::string name;


Based on the information shown here, a possible implementation (.cpp) for Actor is shown below.

#include "Actor.h"

Actor::Actor( std::string n, int a, int e ) : name( n ), academyAward( a ), emmyAward( e )
{ // empty... }

std::string Actor::getName( ) const { return( name ); }
int Actor::getAcademy( ) const { return( academyAward ); }

int Actor::getEmmy( ) const { return( emmyAward ); }

void Actor::act( std::string lines ) const { std::cout << getName( ) << ":" << lines; }

Make sure your definition of Movie supports the following kinds of constructors and builds Actor objects with the correct names:

Movie Fantasia;
// by default, a movie starring Mickey and Minnie Mouse released in 1940

Movie Titanic( "Leonardo DiCaprio", "Kate Winslet", 1997 );
// a file starring Leonardo and Kate released in 1997

Movie StarWars( "Mark Hamill", "Carrie Fisher", 1977 );
// a blockbuster starring Mark and Carrie released in 1977

In addition, make a member operation defined as:

void Movie::action( string maleLeadLines, string femaleLeadLines, bool maleLeadSpeaksFirst );

which shoots a new scene in the movie with the lead actor and actress reading their lines.

Actor with 1 Academy Award, 0 Emmy Awards

// this instance was made by saying:
Actor Mickey( "Mickey Mouse", 1 );

Actor with 0 Academy Awards, 0 Emmy Awards

// this instance was made by saying:
Actor Mickey( "Donald Duck" );

Explanation / Answer

Answer:

1. Movie.h :

#include <string>

class Movie{
    public:
    Movie(std::string movieActor="Mickey Mouse", std::string movieActress="Miney Mouse", int year=1940);
  
    std::string getActorName() const;
    std::string getActressName() const;
    int         getReleaseYear() const;
  
    void action(std::string maleLeadLines, std::string femaleLeadLines, bool maleLeadSpeaksFirst);
  
    private:
    Actor actor, actress;
    int year;
}

2. Movie.cpp :

#include <string>
#include "Actor.h"

Movie::Movie(std::string actorName, std::string actressName, int y)
{
    actor = new Actor(actorName);
    actress = new Actor(actressName);
    year = y;
}

std::string Movie::getActorName() const
{
    return actor.getName();
}

std::string Movie::getActressName() const
{
    return actress.getName();
}

int Movie::getReleaseYear() const
{
    return year;
}

void Movie::action(std::string maleLeadLines, std::string femaleLeadLines, bool maleLeadSpeaksFirst)
{
    if(maleLeadSpeaksFirst)
    {
        actor.act(maleLeadLines);
        actress.act(femaleLeadLines);
    }
    else
    {
        actress.act(femaleLeadLines);
        actor.act(maleLeadLines);
    }
  
}

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