rendered paste bodyusing System;
namespace inputAverage
{
class mainClass
{
static void Main()
{
// James de Mattos, Ch.6
// Scroll assignment-specific information
Documentation();
Console.WriteLine ("Input -999 when you wish to recieve the average and letter grade.");
Console.WriteLine ("Only insert valid integers (1-100, no letters)");
getInput();
}
// Get Input
static void getInput()
{
int Input = 0;
int inputCount = 0;
int Total = 0;
int Output = 0;
while (Input != -999)
{
if (Input >= 0)
if (Input <= 100)
{
inputCount++;
Total += Input;
Console.WriteLine ("\nInput Grade:");
Input = (int.Parse (Console.ReadLine()));
}
else
{
Console.WriteLine ("Invalid Input.");
Input = 0;
inputCount--;
}
if (Input == -999)
{
inputCount--;
Output = Total / inputCount;
Console.WriteLine ("\nAverage: " + Output);
Console.ReadLine ( );
break;
}
}
}
// Provide internal documentation
static void Documentation()
{
Console.WriteLine ("************************************************");
Console.WriteLine ("* Programming Assignment #3, Page 308, Ch. 6 *");
Console.WriteLine ("* Developer: James de Mattos *");
Console.WriteLine ("* Date Submitted: Sep. 19, 2006 *");
Console.WriteLine ("* Purpose: Provide internal documentation. *");
Console.WriteLine ("************************************************\n");
}
}
}