Professional Documents
Culture Documents
Program - Cs Source Code
Program - Cs Source Code
cs Source Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment01
{
class Program
{
public static int Menu_Selection_Validation()
{
string user_input = string.Empty;
bool loop_flag = false;
Console.WriteLine();
return int.Parse(user_input);
}
if (result == false)
{
Console.WriteLine("That's not a valid input please, please try again
with a positive integer values.\n");
}
else if (aNumber <= 0 )
{
Console.WriteLine("Please Enter The values above 0, as the length and
width cannot be zero.\n");
}
else if(aNumber > 32767)
{
Console.WriteLine("Please Enter The values below 32767 as it is the
maximum integer range.\n");
}
else
{
isValid = true;
Console.WriteLine($"Your {selected_option} has been changed to:
{aNumber}.\n");
}
}
return aNumber;
}
}
else if (int.Parse(initial_Selection) == 2)
{
valid_initial_Selection = true;
int length;
int width;
length = User_Input_Validation("length");
width = User_Input_Validation("width");
selection = Menu_Selection_Validation();
while (selection != 7)
{
int result;
switch (selection)
{
case 1:
Console.WriteLine("Length of Rectangle is: {0}\n",
r.GetLength());
break;
case 2:
result = User_Input_Validation("length");
r.SetLength(result);
break;
case 3:
Console.WriteLine("width of Rectangle is: {0}\n", r.GetWidth());
break;
case 4:
result = User_Input_Validation("width");
r.SetWidth(result);
break;
case 5:
Console.WriteLine("Perimeter of Rectangle of Lenght: {0} and
width: {1} is: {2}\n", r.GetLength(), r.GetWidth(), r.GetPerimeter());
break;
case 6:
Console.WriteLine("Area of Rectangle of Lenght: {0} and width:
{1} is: {2}\n", r.GetLength(), r.GetWidth(), r.GetArea());
break;
default:
break;
}
selection = Menu_Selection_Validation();
}
}
}