Complete missing implementations in challenge exercise files #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR completes all the missing implementations in the challenge exercise files throughout the C++ Programming Foundations course repository. Several challenge files contained stub implementations with "Write your code here" comments that needed to be completed for students to have working examples.
Changes Made
Completed 8 challenge exercise files:
src/Ch02/02_13/CodeDemo.cpp
- Data types challenge: Implementedadd_int()
function that casts floating-point parameters to integers and returns their sumsrc/Ch03/03_08/CodeDemo.cpp
- Calculate average challenge: Implementedmy_average()
function that computes the average of three different integer typessrc/Ch04/04_11/CodeDemo.cpp
- Vector manipulation challenge: ImplementedSelectKeyPoints()
function that extracts first, indexed, and last elements from a vectorsrc/Ch05/05_09/CodeDemo.cpp
- Resource cost calculation challenge: ImplementedCalculateTotalCost()
function with tax calculation logic for different resource types (Basic: 5%, Luxury: 15%, Essential: 0%)src/Ch06/06_07/CodeDemo.cpp
- Rhythm game scores challenge: Implemented overloadedCalculateScore()
functions with default parameters for millisecond and second-based scoringsrc/Ch07/07_05b/CodeDemo.cpp
- Inventory class usage: Completed main function with proper inventory operations (add items, display, remove, check count, access by index)src/Ch07/07_10/CodeDemo.cpp
- Person class design challenge: Implemented completePerson
class with private members (name, energy, happiness, health) and public methods (Eat()
,Play()
,Sleep()
, getters)src/Ch08/08_10/CodeDemo.cpp
- Virtual pet schedule challenge: ImplementedManagePetSchedule()
function using deque operations for pet activity managementTechnical Details
All implementations follow the existing code style and patterns in the repository:
Testing
Each implementation has been thoroughly tested:
g++ -std=c++17
This ensures students have complete, working examples for all challenge exercises in the course.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.