Answered step by step
Verified Expert Solution
Question
1 Approved Answer
manipulates a set of Movies. There are two types of Movies in our system: Sci _ Fi Movies and Action Movies. Consider the following UML
manipulates a set of Movies. There are two types of Movies in our system: SciFi Movies and Action Movies. Consider the following UML class diagram. The Movie class is
The size of the castMemebrs array is stored in castMemebrsSize
Each movie has one releaseDate of type Date.
locationDays is an array of integers that stores the number of days for every shoot location. For example, if the first location in the ShootLocationsarray was used for days, the first entry in the locationDays is and so on
The size of locationDays equals the size of shootLocations, which is stored in shootLocationsSize.
Write the default constructor to initialize the data members with proper default values.
Write setters for all data members.
Write getters for all data members.
Write a parameterized constructor that receives value for all data members as follows.
Moviestring name, float rate, Date d CastMember CS ShootLocation SL int LD int castsize, int locationsize
The calculateBudget has no implementation in the movie class, yet it has a different implementation in Scifi and Action classes. The calculateBudget is a pure virtual function that has no implementation in the movie class.
printDetails is a virtual function that prints all the information of the movie. It should call the printDetails function from the classes ShootLocation, Date, and CastMember
Question : Implement the Sci Fi class.
Class SciFi
a Do not separate the header from the implementation; write all the code in Sci Ficpp
b The SciFi class inherits from the Movie class.
c The SciFi class contains three data members: fromAbook bool briefstring additionalCostint
a The calculateBudget should return the total budget which equals the additional cost plus the original cost. The additional cost is stored in the additionalCostsdata member.
The original cost equals the sum of the cost of all shoot locations.
The cost for each shoot location can be calculated by multiplying the
LocationCostPerday in the ShootLocation Class by the number of days which is stored in the LocationsDaysarray.
b Define a void function called shuffle, the function receives an array of Action pointers with its size. The function should apply the following for each pointer.
Shuffle the castMemebrsarray, which means to change the order of the elements in the array randomly.
Shuffle the shootLocationsarray and
LocationsDaysarray, which means to change the order of the elements in the arrays randomly, make sure that the data is still consistent. For example, if the shootLocation that was at index before the shuffling, become at index after shuffling then the locationDayselement that was at index before the shuffling should also become at index after shuffling.
Question :
main
Create an array of two Movie pointers.
The first pointer should point to an Action movie object you can make it in the stack or in the heap The information in the object is from your choice.
The second pointer should point to a SciFi movie object you can make it in the stack or in the heap The information in the object is from your choice.
Actionint numOfHeros, string name, float rate, Date
CastMember CS ShootLocation SL int LD int castsize, int
locationsize
NOTE: Using C language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started