using System;
namespace studentname
{
class student
{
private int idNumber;
private string lastName;
private double gradePointAversge;
public int getld()
{
return idNumber;
}
public string getName()
{
return lastName;
}
public double getGPA()
{
return gradePointAversge;
}
public void setLd(int id)
{
idNumber = id;
}
public void setName(string name)
{
lastName = name;
}
public void setGPA(double gpa)
{
gradePointAversge = gpa;
}
class Program
{
static void Main ()
{
student st = new student();
st.setLd(9353);
st.setName("Teerawat");
st.setGPA(3.98);
Console.WriteLine("Student name {0} has ID # {1} and gpa of{2}",
st.getName(), st.getld(), st.getGPA());
Console.ReadLine();
}
}
}
}
using System;
namespace UserPredefineMethods
{
static class Program
{
static void Main ()
{
double[] waterDepht = { 45, 19, 2, 16.8, 190, 0.8, 510, 6, 18 };
string outputMsg = "";
string caption = "System.Array Methods IIIustrated";
double[] w = new double[20];
outputMsg += "waterDepth Array\n\n";
foreach (double wVal in waterDepht)
outputMsg += wVal + "\n";
MessageBox.Show(outputMsg, caption);
Array.Copy(waterDepht, 2, w, 0, 5);
Array.Sort(w);
outputMsg = "Array w Sorted\n\n";
foreach (double wVal in w)
{
if (wVal > 0)
outputMsg += wVal + "\n";
}
MessageBox.Show(outputMsg, caption);
Array.Reverse(w);
outputMsg = "Array w Reversed\n\n";
foreach (double wVal in w)
{
if (wVal > 0)
outputMsg += wVal + "\n";
}
MessageBox.Show(outputMsg, caption);
}
}
}