CSE 210: Programming with Classes

Final Project: Foundation 4

Overview

Now that you have learned each of the principles of Programming with Classes, the final project will help you "Firm up your Foundation" by practicing each principle in a small project.

This final project is referred to as the "Foundation 4" project, because you will do four smaller programs. Each of these programs is designed to be fairly concrete and will help you strengthen your understanding of the core principles and the mechanics of using them in programming.

To help you stay on track, you need to complete at least the first two programs in Week 06. Then, you can submit the other two in Week 07. You are encouraged to work ahead, and complete all the programs as quickly as you can.

Program Requirements

There is one program for each of the principles of Programming with Classes:

  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism

See the details of each project below.

User Interaction

The focus of these programs is to help you design and build the classes and work with the relationships among these classes. With that in mind, you do not need to create a menu system or a user interface. Instead, your Program.cs file can create the required objects, set their values, and display them as specified, without any user interaction.

Screenshot Submission

For each of these final project program submissions, you will include a screenshot of your program execution in your GitHub repository alongside the corresponding code. See Submission section below for screenshot instructions.

Please note that because the purpose of these programs is to help you practice the principles of the course in a very direct way, you are not expected to show creativity and exceed the core requirements the way you have in previous projects. You can earn 100% by completing the requirements as specified below.

Program 1: Abstraction with YouTube Videos

Scenario

You have been hired by a company that does product awareness monitoring by tracking the placement of their products in YouTube videos. They want you to write a program that can help them work with the tens of thousands of videos they have identified as well as the comments on them.

Program Specification

Write a program to keep track of YouTube videos and comments left on them. As mentioned this could be part of a larger project to analyze them, but for this assignment, you will only need to worry about storing the information about a video and the comments.

Your program should have a class for a Video that has the responsibility to track the title, author, and length (in seconds) of the video. Each video also has responsibility to store a list of comments, and should have a method to return the number of comments. A comment should be defined by the Comment class which has the responsibility for tracking both the name of the person who made the comment and the text of the comment.

Once you have the classes in place, write a program that creates 3-4 videos, sets the appropriate values, and for each one add a list of 3-4 comments (with the commenter's name and text). Put each of these videos in a list.

Then, have your program iterate through the list of videos and for each one, display the title, author, length, number of comments (from the method) and then list out all of the comments for that video. Repeat this display for each video in the list.

Note: The YouTube example is just to give you a context for creating classes to store information. You will not actually be connecting to YouTube or downloading content in any way.

Program 2: Encapsulation with Online Ordering

Scenario

You have been hired to help a company with their product ordering system. They sell many products online to a variety of customers and need to produce packing labels, shipping labels, and compute final prices for billing.

Program Specification

Write a program that has classes for Product, Customer, Address, and Order. The responsibilities of these classes are as follows:

Order
Product
Customer
Address
Other considerations

Make sure that all member variables are private and getters, setters, and constructors are created as needed.

Once you have created these classes, write a program that creates at least two orders with a 2-3 products each. Call the methods to get the packing label, the shipping label, and the total price of the order, and display the results of these methods.

Program 3: Inheritance with Event Planning

Scenario

You have been hired by an event planning company. They help organize and market events throughout the world. They need you to write a program to track each of these events and produce the marketing material to distribute on social media. They typically handle a few main types of events:

Regardless of the type, all events need to have an Event Title, Description, Date, Time, and Address.

They would like the ability to generate three different messages:

  1. Standard details - Lists the title, description, date, time, and address.
  2. Full details - Lists all of the above, plus type of event and information specific to that event type. For lectures, this includes the speaker name and capacity. For receptions this includes an email for RSVP. For outdoor gatherings, this includes a statement of the weather.
  3. Short description - Lists the type of event, title, and the date.
Program Specification

Write a program that has a base Event class along with derived classes for each type of event. These classes should contain the necessary data and provide methods to return strings for each of the messages the company desires.

Remember that any data or methods that are common among all types of events should be in the base class.

Once you have the classes in place, write a program that creates at least one event of each type and sets all of their values. Then, for event event, call each of the methods to generate the marketing messages and output their results to the screen.

In addition, your program must:

  1. Use inheritance to avoid duplicating shared attributes and methods.
  2. Use an address class for the addresses.
  3. Follow the principles of encapsulation, making sure each member variable is private.

Program 4: Polymorphism with Exercise Tracking

Scenario

The local fitness center has hired you to write an app for their customers to track their exercise. They have facilities for the following:

For each activity, they want to track the the date and the length of the activity in minutes. Then, for each activity, they would like to also track the following:

For each activity, they do not want to store this information, but they would like to be able to get following information (by calculation if it is not stored directly):

You may choose if your program uses miles or kilometers (you do not need to handle both). In either case the length of a lap in the lap pool is 50 meters.

Program Specification

Write a program that has a base Activity class and then has a derived class for each of the three activities. The base class should contain any attributes that are shared among all activities. Then, each derived class can define any additional attributes.

In addition, the base class should contain virtual methods for getting the distance, speed, pace. These methods should be overridden in the derived classes.

Finally, you should provide a GetSummary method to produce a string with all the summary information.
Remember that the summary method can make use of the other methods to produce its result. This method should be available for all classes, so it should be defined in the base class (you can override it in the derived classes if needed, but it may not need to be...).

Once you have the classes in place, write a program that creates at least one activity of each type. Put each of these activities in the same list. Then iterate through this list and call the GetSummary method on each item and display the results.

In addition, your program must:

  1. Use inheritance to avoid duplicating shared attributes and methods.
  2. Use method overriding for the calculation methods.
  3. Follow the principles of encapsulation, making sure each member variable is private.
Math Hints:

Submission

There is a separate assignment in Canvas for each of the four programs. You should return to Canvas and submit each one when it is finished, along with a corresponding screenshot.

To capture and upload screenshot of the program execution, follow these steps:
  1. Run your program in VS Code.
  2. Maximize your VS Code window and ensure entire program execution is visible.
  3. Capture screenshot.
  4. Open your Github Repository in your internet browser, navigate to the folder containing your project code.
  5. Click Add File-> Upload Files.
  6. Drag and drop screenshot from your Desktop to your GitHub window.
  7. Click Commit changes.