Neon wolf standing on rocks above a futuristic city under a glowing moon

C# Calculator

In this classic starter project of using C#, I created a calculator. This was thought out in three simple steps:
1: Getting the Input
2: Storing Values
3: Doing the Calculations

Getting the input was simple enough. Just type in the numbers using the keyboard.Storing the values was more difficult. The numbers had to be stored as variables in the program.Making sure the calculations came out after the user hits enter or equals.

class MainClass
{
public static void Main(string[] args)
{
bool keepGoing = true;
int savedValue = 0;
do
{
Console.WriteLine(“Provide the first value:”);
string firstInput = Console.ReadLine().ToUpper();
int firstValue = 0;
if (firstInput == “MR”)
{
firstInput = savedValue.ToString();
}
bool isNumeric = int.TryParse(firstInput, out firstValue);
while (!isNumeric)
{
Console.WriteLine(“Not a number, please provide a value: “);
firstInput = Console.ReadLine();
isNumeric = int.TryParse(firstInput, out firstValue); 
} 
Console.WriteLine(“Provide an operation (+, -, *, /):”);
string operationValue = Console.ReadLine();
while (operationValue != “+” && operationValue != “-” && operationValue != “*” && operationValue != “/”)
{ 
Console.WriteLine(“Not a supported operation, please provide an operation (+, -, *, /): “);
operationValue = Console.ReadLine(); 
} 
Console.WriteLine(“Provide second value: “);
string secondInput = Console.ReadLine().ToUpper();
int secondValue = 0;
if (secondInput == “MR”) 
{ 
secondInput = savedValue.ToString();
} 
bool isNumeric2 = int.TryParse(secondInput, out secondValue);
while (!isNumeric2)
{ 
Console.WriteLine(“Not a number, please provide second value: “);
secondInput = Console.ReadLine();isNumeric2 = int.TryParse(secondInput, out secondValue); 
}
int total = 0;
switch (operationValue) 
{
case “+”: total = firstValue + secondValue;
break;
case “-“: total = firstValue – secondValue;
break;
case “*”: total = firstValue * secondValue;
break;
case “/”: total = firstValue / secondValue;
break;
defult: Console.WriteLine(“Invalid operation value”);
}
Console.WriteLine(“Total = ” + total);
Console.Write(“Would you like to do something else (yes, no, save)? “);
string finalInput = Console.ReadLine().ToUpper();
switch(finalInput)
{
case “No”: keepGoing = false;
break;
case “Yes”:
break;
case “Save”: savedValue = total;
break;
defult:
break;
}
}
while (keepGoing);
} 
}
}