DEV Community

Cover image for First Steps in C++: An Introductory Capstone Project
Jose Maria Iriarte
Jose Maria Iriarte

Posted on

First Steps in C++: An Introductory Capstone Project

This article presents a capstone project from an Introduction to Computer Science course, designed for beginners to learn C++ fundamentals. The project is divided into four stages or sub-projects, each corresponding to a different set of core concepts, from basic data types and control structures to advanced topics like object-oriented programming and code optimization. The project focuses on processing and analyzing manufacturing orders for cones and frustums, incorporating user input validation, geometric calculations, and cost analysis. As the project progresses, students learn essential software engineering principles, such as the use of classes, functions, and vectors, ultimately culminating in a comprehensive application that integrates all the skills learned throughout the course. The project files are shared on GitHub for anyone looking to explore a hands-on, structured approach to mastering C++.


In this article, I want to share the capstone project from my Introduction to Computer Science course in college.

In Introduction to Computer Science I, we used C++ to explore the fundamentals of programming languages.

Reviewing the repository containing the project files for this course will be incredibly useful for anyone taking their first steps with C++ and seeking exposure to a comprehensive project that integrates all the individual building blocks into a cohesive whole.

GitHub logo tigerbluejay / CPlusPlusDeveloperEssentialPackage

C++ Computer Science Fundamentals Projects: From Data Types to Object Oriented Architecture. Gerogetown University - Introduction to Computer Science I Project - Summer 2016

Introduction to Computer Science I (Georgetown University - Summer 2016)

This repository contains four C++ projects (and sample pseudocode for one of them).

Project 1 and Project 1 Pseudocode files cover:

basic data types, the C++ string class, variables and constants, input/output (cin/cout) operators, assignment operators, arithmetic operators, conditional control structures

Project 2 files cover:

Topics in Project 1 + repetition control structures, basic file operations

Project 3 files cover:

Topics in Projects 1-2 + user-defined functions, value and reference parameters, elementary software engineering principles, the vector class,

Project 4 files cover:

Topics in Projects 1-4, constructor, function and operator overloading, accessors, mutators, code optimization




The capstone project in question is in reality four distinct standalone projects, each consists of a console application that takes input from the user and provides information based on that input.

When I uploaded the files to GitHub, I referred to each stage as a “Project” for simplicity, but you can think of each successive Project as a stage that builds upon the previous one. Thus, Project 4 builds on Project 3, Project 3 builds on Project 2, and so on.

In reality each project functions as a sandalone application, but each successive project is a more "refined" version of the previous.

Feel free to review the files in each of the four project folders.

Within each folder, the main code files are named
jmi34P1.cpp for Project 1,
jmi34P2.cpp for Project 2,
jmi34P3.cpp for Project 3,
and jmi34P4.cpp for the final project.

You will also find additional ancillary files in each folder, such as helper code or pseudocode, but the core files listed above contain the central logic and function on their own.

As mentioned before, each of the four projects is a standalone version of an application that does similar things: It takes input from the user, displays some error messages where necessary, performs calculations, and outputs information.

Now in more detail: The applications corresponding to Projects 1 through 4 serve as a comprehensive tool for processing, validating, and analyzing manufacturing orders for cones and frustums (used for lamp shades).

They prompt the user to input a file (and in the initial versions just console input) containing shape order data, such as shape type, dimensions, color, and closure status. The programs use predefined constants and validation checks to ensure all inputs fall within acceptable ranges. Invalid inputs, such as incorrect shape codes, color codes, or dimension values, are flagged and reported, while valid records proceed to detailed geometric and cost-based calculations.

User-friendly messages and tables guide the user through the process, ensuring clarity and ease of use. For each valid shape record, the programs calculate key geometric properties, including lateral surface area, top and base surface areas, total surface area, and derived parameters like slant heights and angles. They then compute the raw material cost and sales price based on these metrics, adding a markup for profit. Invalid records are excluded from these calculations but still documented in the output.

The programs maintain cumulative totals for surface areas, costs, and sales prices, separately aggregating data for cones and frustums to generate summary statistics and averages. The applications conclude by presenting a detailed summary report in a well-formatted table, showing total and average surface area, raw material costs, and sales prices for both cones and frustums. They also include counters for the total number of records processed, the number of valid cone and frustum records, and the number of records containing errors.

In Projects 3 and 4, the logic and structure are adjusted to incorporate more advanced concepts of an introductory computer science course.

At the core of the applications is the Shape class, which encapsulates information about each manufactured object. This includes order details, dimensions (radius1, radius2, height), shape code (C for cone, F for frustum), color code, and other relevant attributes. The class provides member functions to calculate geometric properties (such as surface area, generating functions, and angles), as well as cost and price.

The latter applications present a user-friendly menu with options to load data from a file, generate a summary report by region, and generate a summary report by shape.

The loadData function reads data from the specified file, validates the input, and creates a vector of Shape objects. The summaryByRegion function calculates and displays the total surface area, cost, and price for each region (North, South, East, West, Other), along with averages across all regions. Similarly, the summaryByShape function calculates and displays the same metrics for cones and frustums separately.

I hope you will enjoy these four projects, and I hope they will serve to review the basic concepts of the C++ programming language.

Topics Covered in Each Project

Project 1: Covers basic data types, the C++ string class, variables and constants, input/output (cin/cout) operators, assignment operators, arithmetic operators, and conditional control structures.

Project 2: Builds on the concepts from Project 1, adding repetition control structures and basic file operations.

Project 3: Builds on the concepts from Project 2, introducing user-defined functions, value and reference parameters, elementary software engineering principles, and the vector class.

Project 4: Builds on the concepts from Project 3, adding constructors, function and operator overloading, accessors, mutators, and code optimization.

Top comments (0)