Question 1

Define a class that models a simple date using integer month, day, and year attributes. Write a program that does the following:

  • Creates a collection of dates using an STL container
  • Displays the collection using the STL 'foreach' algorithm
  • Sorts the collection in descending date order using the STL 'sort' algorithm and displays the sorted collection using the STL foreach' algorithm
  • Counts and displays the number of odd dates in the collection using one or more STL algorithms. An odd date is a date having an odd day number (1-31).

Use the following dates: 12/12/2012, 12/31/2013, 10/12/2012, 6/18/2013, 4/30/2013, 9/25/2012. You do not have to prompt for user input. Submit a screen capture of program output along with your source code.

Question 2

TWO GUI component libraries have been purchased to replace an existing component library that has been used to develop many applications. It is important that current and future applications be able to employ the new components using the existing programming interfaces. The interface for the current window components contains open(), close(), and move() methods. The new libraries both contain window classes, but the interfaces are different. The window class for one library uses openWin(), closeWin(), and moveWin() methods. The other library uses winopen(), winclose(), and winMove () methods. Develop a design that will enable the new libraries to be used with the existing programming interface. You must use a design pattern in your solution and you must submit a class diagram illustrating the design of your solution. Test your solution by writing an application that instantiates several windows and invokes the three methods from each of the new libraries. Implement the methods to display messages like "opening window from library 2", etc.

Question 3

A project team is developing a C++ application that will serve as an educational tool to help children learn about various concepts such as vehicles, animals, sounds, etc. The application will have a need to draw various objects (e.g., animals, vehicles) on the video display as well as to play sounds (if applicable) that are associated with the objects. The project manager has specified that all objects in the application should use a common interface (i.e., a common set of method names) for drawing and playing sounds, and that these interfaces should be reusable for other application projects as well. Some future applications will need to make sounds, some will need drawing capability, and some will need both. Methods called drawObject() and rotateObject() will be used for drawing objects, and a playSound() method will be used for sounds. Design the interface classes Drawable and Sounds, and develop a program that does the following: An Animal class will be used to model some basic characteristics of animals for the application. An animal will have a name attribute and methods to set the name and get the name. Animals can make sounds and are drawable. A Vehicle class will be used to model some basic characteristics of vehicles. A vehicle will have a name and an age, and methods to get/set these attributes. Vehicles can also make sounds and are drawable. Create a collection of 2 vehicles and 2 animals stored in the same array. Loop through the array and execute the drawObject(), rotateObject(), and playSound() methods for each element in the array polymorphically (i.e., don't test for the type of object). The drawObject() method should simply display the message "Drawing a Vehicle" or "Drawing an Animal; the rotateObject() method should display the message "Rotating a Vehicle" or "Rotating an Animal"; and the playSound() method should display the message "Animal sound" or "Vehicle sound", depending upon the type of element that is in the array.

1. Draw a class diagram for your solution. You must use a drawing tool.

2. Submit all source code and a screen capture of the output.

Question 4

The information below about students and test scores should be stored in two STL containers. Write a program that calculates and displays the student name, and minimum, maximum, and average test scores for that student. Submit a screen capture of the program output in addition to the program source code. You must use STL algorithms for the minimum and maximum calculations.

Student Number First Name Last Name
1
2
3
Mona
Shagga
Sim
Chrome
Dellic
Carder

Student Number Test Score
1
2
3
1
2
3
1
2
60
90
75
90
95
85
85
80
3
1
2
3
90
60
85
70

Note: Your solution should not be dependent upon the order of the data in each row of the above table.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.