using System;
using System.Collections.Generic;
using System.Text;
namespace Problem_3
{
class Program
{
static void Main(string[] args)
{
string a, b, c, d;
int A, B, C, D;
Console.Write("Enter integer 1: ");
a = Console.ReadLine();
Console.Write("Enter integer 2: ");
b = Console.ReadLine();
Console.Write("Enter integer 3: ");
c = Console.ReadLine();
Console.Write("Enter integer 4: ");
d = Console.ReadLine();
Console.WriteLine("");
A=Int32.Parse(a);
B = Int32.Parse(b);
C = Int32.Parse(c);
D =Int32.Parse(d);
MathUtil Math = new MathUtil(A, B, C, D);
Console.WriteLine("Sum: "+Math.sum);
Console.WriteLine("Product: " + Math.multi);
Console.WriteLine("Difference: " + Math.diff);
Console.WriteLine("Qoutient: " + Math.qout);
Console.ReadLine();
}
}
public class MathUtil
{
#region "fields"
int num1;
int num2;
int num3;
int num4;
float P3, P4;
#endregion
#region "constructor"
public MathUtil(int num1,int num2,int num3,int num4)
{
this.num1 = num1;
this.num2 = num2;
this.num3 = num3;
this.num4 = num4;
this.P3 = num3;
this.P4 = num4;
}
#endregion
#region "R-only Propertys"
public int sum
{
get
{
return num1+num2+num3+num4;
}
}
public int multi
{
get
{
return num1 * num2 * num3 * num4;
}
}
public int diff
{
get
{
return num1 - num2;
}
}
public float qout
{
get
{
return P3 / P4;
}
}
#endregion
}
}
Sunday, July 22, 2007
[Answer] Review Exercises #3
Copy and paste this code to answer the question on the www.dotnetstarter.blogspot.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment