Background : Sanele was invited to Lindiwe’s birthday party. He would have attended anyway since she is a good friend of his. But when he saw the party would be at her parents’ house and the instruction was to “come hungry,” he was intrigued. So, he dutifully skipped lunch the day of the party. As he walked up to the house, the smell of barbecue started getting stronger. He was still standing with his eyes closed and a silly grin on his face, inhaling as deeply as he could when she opened the door. Her melodious laugh brought him suddenly back to reality. After an embarrassing moment, he remembered to wish her a happy birthday. It turns out Lindiwe’s parents have some excellent skills when it comes to cooking. And some secret family recipes, too, it is said. Sanele was glad that he followed the instruction to come hungry! Chicken, beef, and a leg of lamb were on the braai, all cooked to perfection. And don’t forget about the roasted mielies. There was a big pot of pap with a very flavourful chakalaka sauce next to it. There were salads, roast vegetables, and sweet potatoes. And freshly baked bread straight from the oven. Sanele was in heaven. Just when he thought the day couldn’t get any better, it was time for dessert. There was malva pudding with custard and chocolate pudding with chocolate ice cream. When Lindiwe’s dad spotted Sanele stuck choosing between the two, he casually suggested, “Why not have both?” That day, Sanele decided he needed to learn how to cook fantastic food like that. If a lawyer and a doctor can do this in their free time, so can he. In this portfolio of evidence, you will develop a recipe app to start him on his journey.

Instructions: This portfolio of evidence consists of three parts–two parts submitted during the semester and a final submission at the end of the semester. The parts build on one another, so keep a copy of your work safe. In the first part, you will create a command-line application that allows the user to enter and store the ingredients and steps for one recipe. In the second part, you will extend it to support multiple recipes and include nutritional information. In the final submission, you will change the user interface to a more user-friendly graphical one. The requirements of real software projects frequently change, often in quite unexpected ways. Here, you have the benefit of knowing what all the requirements will be in advance. So, make use of the opportunity. Reading all three parts before starting with the first one will minimise any reworking for later parts. The rubrics that will be used to mark your submissions appear at the end of this document. Please pay attention to the weighting of items in the rubrics. Note that marks will be awarded for running functional software, not just source code. So, ensure that your source code compiles, and that the readme file contains enough information about running the software.
Part 1 — Object-Oriented Programming (Marks: 100)
Learning Units 1 and 2
At the end of this specific part, students should be able to:
• Write a console programme that requires user input.
• Apply string manipulation to solve a programming problem.
• Use automatic properties to solve a programming problem.

Using C# and Visual Studio, design and implement a standalone command line application that fulfils the following requirements:
1. The user shall be able to enter the details for a single recipe:
a. The number of ingredients.
b. For each ingredient: the name, quantity, and unit of measurement. For example, one tablespoon of sugar.
c. The number of steps.
d. For each step: a description of what the user should do.
2. The software shall display the full recipe, including the ingredients and steps, in a neat format to the user.
3. The user shall be able to request that the recipe is scaled by a factor of 0.5 (half), 2 (double), or 3 (triple). All the ingredient quantities shall be changed accordingly when the recipe is displayed. For example, one tablespoon of sugar will become two tablespoons of sugar if the factor is 2.
4. The user can request that the quantities be reset to the original values.
5. The user shall be able to clear all the data to enter a new recipe.
6. The software shall not persist the user data between runs. The data shall only be stored in memory while the software is running.
Non-functional requirements:
1. You are required to use internationally acceptable coding standards. Include comprehensive comments explaining variable names, methods, and the logic of programming code.
2. You are required to use classes.
3. Store the ingredients and steps in arrays.

Solution:

RecipeApp.cs

```csharp
using System;

namespace RecipeApp
{
class Recipe
{
public string[] Ingredients { get; set; }
public string[] Steps { get; set; }

public void DisplayRecipe()
{
Console.WriteLine("Ingredients:");
foreach (string ingredient in Ingredients)
{
Console.WriteLine("- " + ingredient);
}

Console.WriteLine("\nSteps:");
for (int i = 0; i < Steps.Length; i++)
{
Console.WriteLine((i + 1) + ". " + Steps[i]);
}
}

public void ScaleRecipe(double factor)
{
Console.WriteLine("\nScaled Recipe:");
foreach (string ingredient in Ingredients)
{
string[] parts = ingredient.Split(' ');
double quantity = Convert.ToDouble(parts[0]) * factor;
Console.WriteLine("- " + quantity + " " + parts[1] + " " + parts[2]);
}
}
}

class Program
{
static void Main(string[] args)
{
Recipe recipe = new Recipe();

Console.Write("Enter the number of ingredients: ");
int numIngredients = Convert.ToInt32(Console.ReadLine());
string[] ingredients = new string[numIngredients];
for (int i = 0; i < numIngredients; i++)
{
Console.Write("Enter ingredient " + (i + 1) + ": ");
ingredients[i] = Console.ReadLine();
}
recipe.Ingredients = ingredients;

Console.Write("\nEnter the number of steps: ");
int numSteps = Convert.ToInt32(Console.ReadLine());
string[] steps = new string[numSteps];
for (int i = 0; i < numSteps; i++)
{
Console.Write("Enter step " + (i + 1) + ": ");
steps[i] = Console.ReadLine();
}
recipe.Steps = steps;

recipe.DisplayRecipe();

Console.Write("\nEnter a scaling factor (0.5, 2, or 3): ");
double factor = Convert.ToDouble(Console.ReadLine());
recipe.ScaleRecipe(factor);

Console.WriteLine("\nPress any key to clear recipe and enter a new one...");
Console.ReadKey();
Console.Clear();

Main(args);
}
}
}
```

This code allows the user to enter details for a single recipe, display the full recipe, scale the recipe by a factor, reset the quantities to the original values, and clear all data to enter a new recipe.

Compile and run the above code in Visual Studio to create the command-line application for entering and storing recipe details.