⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpledate.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
package Entities;

/**	A simple class that represents a date */
public class SimpleDate implements Cloneable
{

	public SimpleDate(int nDay, int nMonth, int nYear)
	{
		day = nDay;
		month = nMonth;
		year = nYear;
	}
		
	public  int day;
	public  int month;
	public  int year;
	
	public void incDay()
	{
		if (day < 30)
			day++;
		else
		{
			day  = 1;
			if (month < 12)
				month++;
			else
			{
				month = 1;
				year++;
			}
		}
	}
	
	/**	A method which return the clone of the Shape <br>
		Analysis : Time = O(1) */
	public Object clone()
	{
		try
		{
			return super.clone();
		}catch (CloneNotSupportedException s) {}
		return this;
	}
	
	public  String toString()
	{
		return (day + "/" + month + "/" + year);
	}

} /* end of SimpleDate */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -