namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Declare variables
int age, childD = 12, teenD = 18, adultD = 65, seniorD = 66;
string classif, child = "0", teen = "0", adult = "0", senior = "0";
//Ask their age
Console.WriteLine("How old are you?");
//Save the answer
age = int.Parse(Console.ReadLine());
//Display persons age
Console.WriteLine("Persons Age: {0}", age);
//Calculate the class and multiplier
if (age <= childD)
{
classif = child;
}
else if (age <= teenD && age > childD)
{
classif = teen;
}
else if (age <= adultD && age > teenD)
{
classif = adult;
}
else if (age >= seniorD)
{
classif = senior;
}
//Display classification
Console.WriteLine("Classification: {0}", classif);
//Stay on page
Console.ReadLine();
}
}
}
This post has been edited by GunnerInc: 17 February 2013 - 12:12 AM
Reason for edit:: Fixed broken code tags

New Topic/Question
Reply



MultiQuote




|