Structure of the new program - activity scheduler program

Assignment Help Computer Engineering
Reference no: EM131285604

Class Factory - Activity Scheduler

For this assignment you will modify the Activity Scheduler program, changing it to use the Class Factory design pattern. The behavior of the program is exactly as before. The structure of the new program is shown below:

1103_figure3.jpg

As before, assume that the user will enter the correct type of input in response to the prompts.

Classes IActivity, Activity, Name, LanId, and PhoneNumber

These classes are the same as before.

Class ScheduledActivity

This class is almost the same as before, except that now it both creates and destroys the IActivity objects:
- The constructor argument is now a pointer to a Factory object (not a pointer to an IActivity object). The constructor does exactly what it did before, except that it sets the attribute ‘activity' by invoking the Factory method NewActivity() (instead of setting it from the argument).
- The destructor now deletes the attribute ‘activity'.

Class Scheduler
This class is almost the same as before, except that it passes Factory objects to ScheduledActivity:
- Method addActivity() now takes a parameter that is a Factory* (instead of an IActivity*). It passes this parameter to the ScheduledActivity constructor.

Class Factory
This class is the interface for the four subclasses below. It has the following:
- A pure virtual method NewActivity(), which returns an IActivity*.
- A virtual destructor with an empty implementation (provided in the class declaration).

Classes ActivityFactory, LanIdFactory, NameFactory, and PhoneNumberFactory
These four classes implement interface Factory. Each provides an implementation of method NewActivity(), returning a new object of the appropriate type. (For example, ActivityFactory::NewActivity() returns a new Activity object, LanIdFactory::NewActivity() returns a new LanId object, etc.)

File MainControl.cpp, method main
This method is simpler than before, since it is no longer responsible for creating and destroying activities. Instead it creates four Factory objects (NameFactory, LanIdFactory, PhoneNumberFactory, and ActivityFactory). It passes each of these to the scheduler's addActivity() method, and deletes all four Factory objects. Then it calls the scheduler's run() method, and returns 0.

General Information
Make sure you follow all coding conventions.

Make sure you have no memory leaks: delete any objects that are no longer reachable by any pointer.

Reference no: EM131285604

Previous Q& A

  The ways marketing has helped our political process

What are some of the ways marketing has helped our political process? What are some ways the marketing of politicians might have an adverse effect on our government?

  Human resource competency study aid

How would the HR skills identified in the Human Resource Competency Study aid an HR executive in assessing potential outsourcing partners?

  Find the damping coefficient of each spring

An electric motor and its base have a combined mass of M = 12 kg Each of the four springs attached to the base has a stiffness k = 480 kN/m and a viscous damping coefficient c.

  Why did black actors play in roles that were not necessarily

How were black actors portrayed in independent black films? Why did black actors play in roles that weren't necessarily positive stereotypes? What is meant by the "No Negro" era?

  Is it ethical for churches and religious organizations

What are some ways that these organizations market themselves that are similar to and different from the marketing by for-profit businesses?

  Most people in economy are employed by service industries

Why do you think this has occurred? In what ways is this trend a good and/or a bad thing for a country? Do you think this trend will continue?

  Find frequency f of small oscillations about this position

The 8-kg uniform plate supported by the pin at O is in equilibrium in the position shown. Find the frequency f of small oscillations about this position.

  Provide a comprehensive definition for renaissance

Provide a comprehensive definition for "Renaissance." Define "readymade" and provide an example that best exemplifies this type of art. How does Analytical Cubism reflect the way we actually see?

  Write and test a function that computes the time

Write a script le that accepts user input for d, L, and r and computes and displays C. Test the le with the values L = 1 m, r = 0.001 m, and d = 0.004 m.

  Charts the commonalities between the given historic periods

Write an essay that charts the commonalities between these historic periods. In short, you should link the cultures of the 16th and 18th centuries by highlighting shared ideas and traditions in art that appeared during the Renaissance and reappea..

Reviews

Write a Review

 

Similar Q& A

  Questiona declare principles behind object oriented

questiona declare principles behind object oriented software development and describe why it is considered better than

  Program to persons ability to vote

Write down a program which asks for the user's age. On the basis of their response print "You may vote" (18 years old or older) or "You can't vote"

  What is a user friendly text editor

What is a user friendly text editor which comes pre-installed in Mint that can be used directly in the terminal and Having a system which is not update can be at best

  In brief discuss xml and its standards

create some example code using XML and the corresponding DTL for the tags used in the XML.

  Briefly describe the concept of queues

Briefly describe the concept of queues.

  Draw the logic diagram of a 2-bit demultiplexer

Draw the logic diagram of a 2-bit demultiplexer, a circuit whose single input line is steered to one of the four output lines depending on the state of the two control lines.

  Explain how the new forms meet usability standards

Describe how these new forms meet usability standards. Incorporate additional research or academic information to support your presentation. Format your PowerPoint according to APA guidelines.

  What will the swap macro

What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile?

  Write down a public static method named chunk25

Write down a public static method named chunk25 that takes a double and returns an integer that represents the number of chunks of 25 in that number. A chunk of 25 is 25, or any part thereof

  Write a recursive implementation of euclids algorithm

Write a recursive implementation of Euclids algorithm

  Proceed according to the following instructionsidentify a

proceed according to the following instructions.identify a recent within the last six 6 months moral dilemma or

  What are the differences between a pre-test loop a

wrtie 200-300 woods on this questionwhat are the differences between a pre-test loop a post-test loop and a for

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd