01-10-2008, 12:13
|
|
|
חבר מתאריך: 29.09.08
הודעות: 114
|
|
בתגובה להודעה מספר 11 שנכתבה על ידי Web שמתחילה ב "נסי להזכר, זה גם משהו שנתקבשת למעשה לעשות בתרגיל קודם.."
בס"ד
זה כל הפונקציות
using System;
using System.Collections.Generic;
using System.Text;
public class Date
{
private int day;
private int month;
private int year;
public void SetDate(int day, int month, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
public int GetDay()
{
return this.day;
}
public int GetMonth()
{
return this.month;
}
public int GetYear()
{
return this.year;
}
public int DayInYear()
{
if (this.year % 4 == 0)
return 366;
else return 365;
}
public bool IsInteresting()
{
if (this.day == this.month)
{
if (this.day >= 1 && this.day <= 9)
{
if (this.day == this.year % 10)
return true;
}
else if (day > 9)
{
if (this.day == this.year % 100)
return true;
}
else return false;
}
return false;
}
public int DaysPass()
{
int sum=0;
if (this.month == 1)
sum += day;
else
if (this.month == 2)
sum += 31 + day;
else
if (this.month == 3)
sum += 31 + 28 + day;
else
if (this.month == 4)
sum += 31 + 28 + 30 + day;
else
if (this.month == 5)
sum += 31 + 28 + 30 + 30 + day;
else
if (this.month == 6)
sum += 31 + 28 + 30 + 30 + 30 + day;
else
if (this.month == 7)
sum += 31 + 28 + 30 + 30 + 30 + 30 + day;
else
if (this.month == 8)
sum += 31 + 28 + 30 + 30 + 30 + 30 + 30 + day;
else
if (this.month == 9)
sum += 31 + 28 + 30 + 30 + 30 + 30 + 30 + 30 + day;
else
if (this.month == 10)
sum += 31 + 28 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + day;
else
if (this.month == 11)
sum += 31 + 28 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + day;
else
if (this.month == 12)
sum += 31 + 28 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + 30 + day;
return sum;
}
public String Tostring()
{
String str = (this.day + "/" + this.month + "/" + this.year);
return str;
}
}
ואמרו לפתוח מחלקה חדשה אז למה לרשום בתכנית הראשית?
|