Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 23, 2025

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: Implemented add_int() function that casts floating-point parameters to integers and returns their sum
  • src/Ch03/03_08/CodeDemo.cpp - Calculate average challenge: Implemented my_average() function that computes the average of three different integer types
  • src/Ch04/04_11/CodeDemo.cpp - Vector manipulation challenge: Implemented SelectKeyPoints() function that extracts first, indexed, and last elements from a vector
  • src/Ch05/05_09/CodeDemo.cpp - Resource cost calculation challenge: Implemented CalculateTotalCost() 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 overloaded CalculateScore() functions with default parameters for millisecond and second-based scoring
  • src/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 complete Person 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: Implemented ManagePetSchedule() function using deque operations for pet activity management

Technical Details

All implementations follow the existing code style and patterns in the repository:

  • Use C++17 standard features appropriately
  • Include proper error handling and boundary checks
  • Match the expected behavior from corresponding solution files
  • Maintain consistent naming conventions and formatting

Testing

Each implementation has been thoroughly tested:

  • All files compile successfully with g++ -std=c++17
  • Each program produces the expected output when run
  • Implementations match the logic and results from corresponding solution files

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.

Copilot AI and others added 3 commits September 23, 2025 21:47
Co-authored-by: RobNich <166557994+RobNich@users.noreply.github.com>
Co-authored-by: RobNich <166557994+RobNich@users.noreply.github.com>
Co-authored-by: RobNich <166557994+RobNich@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] code Complete missing implementations in challenge exercise files Sep 23, 2025
@Copilot Copilot AI requested a review from RobNich September 23, 2025 21:56
Copilot finished work on behalf of RobNich September 23, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants