Let’s develop a solid foundation in procedural/structured programming by solving a mixed fraction arithmetic calculator case study.

Case study: Mixed fraction arithmetic calculator

We’ll tackle our case study by breaking it down into manageable tasks, called functions, and then use them to write the complete flow (the sequence) of the program. We’ll discuss each step of the coding process and learn how to derive other arithmetic operations from the structure of our addition function. Let’s solve this case study!

We already know how to compute arithmetic operations on mixed fractions mathematically (as we did in the “Chapter Overview” lesson). How can we implement it in code?

Finding out the memory requirement

First, we need something that can store our mixed fraction and let us access its individual components (whole number, numerator, and denominator) to perform our arithmetic operations.

For that, we’ll use variables as shown below:

Get hands-on with 1200+ tech skills courses.