Hello again, C# corner users!
I need to make a program that will add numbers that user inputs, until user inputs 0.
It should look like this at the end:
----------------------------------------------------
[Summation of Real numbers]
Write 0 to Finish
Write an amount to sum or 0 to finish: 50
Write an amount to sum or 0 to finish: 40
Write an amount to sum or 0 to finish: 10.5
Write an amount to sum or 0 to finish: 0
The sum is : 100.5
----------------------------------------------------
Below are the outlines that I got so far:
Thanks for your help guys!
public class FloatNumbersWhileAdd
{
private double sum;
public void Start()
{
WriteProgramInfo();
ReadInputAndSumNumbers();
ShowResults();
}
private void WriteProgramInfo()
{
// Coding part here
}
private void ReadInputAndSumNumbers()
{
bool done = false;
while (!done)
{
// Coding part here
}
}
private double ReadInput()
{
Console.Write("Write an amount to sum or zero to finish: ");
double num = double.Parse(Console.ReadLine());
return num;
}
private void ShowResults()
{
// Coding part here
}
}
}