《算法4》的课后练习题1.2.11,页码为72页。实现一个SmartDate类,在日期非法时抛出异常,并添加一个dayOfTheWeek()方法,输出这天是星期几。 public class SmartDate { private int year; private int month; private int day; public SmartDate(int year,int month,int day){ this.year = year; this.month = month; this.day = day; } public int year() throws Exception{ if(year < 0) throw new RuntimeException("年份不能为负数!"); return year; } public int month()throws Exception{ if(month < 0) throw new RuntimeException("月份不能为负数!"); if(month > 12) throw new RuntimeException("月份不能大于12 !"); return month; } public int day()throws Exception{ //1,3,5,7,8,10,12月有31天 //4,6,9,11月有30天 if(month == 4 || month == 6 || month == 9 || month == 11){ if(day > 30) throw new RuntimeException(month+"月份没