• java 08 作业


    三角形的三边之和

    ------------------------------------------------------------------------

    class Triangthroeb{
    public static void main(String[] agrs) {
    Person p = new Person();
    try{
    p.Person(1,1,3);
    }
    catch(TriangchaException e){
    e.printlnError();

    }

    catch(TriangException e){
    e.printlnError();

    }
    finally {
    System.out.println("程序执行完毕");

    }

    }
    }

    class Person{
    private int a;
    private int b;
    private int c;

    /* public Person (int a , int b , int c)throws TriangchaException,TriangException{
    if (a<0||b<0||c<0 ){

    throw new TriangException("参数为负数");
    }
    else if (a+b < c ||a+c < b ||b+c < a){
    throw new TriangchaException();
    }

    this.int a = a;
    this.int b = b;
    this.int c = c;
    } */


    public int Person(int a,int b,int c) throws TriangchaException,TriangException{
    if (a<0||b<0||c<0 ){

    throw new TriangException("参数为负数");
    }
    else if (a+b < c ||a+c < b ||b+c < a){
    throw new TriangchaException();
    }

    return a;

    }
    }


    class TriangException extends Exception{
    private String info;
    public TriangException (String info){
    this.info =info;
    }
    public void printlnError(){
    System.out.println(info);
    }
    }

    class TriangchaException extends TriangException{
    public TriangchaException (String info){
    super(info);
    }
    public TriangchaException(){
    this("两边之和小于第三边");
    }
    }

    ------------------------------------------------------------------

    判断输入的日期是否正确

    (年份,月份,日)

    代写  课程在09-01作业即可查看

    年 ;;;;

    月 1-12

    日 1-31  除了2月

    public int year,mounth, date

    public  void  setBirthday(int year,int mounth,int date) {

    }

  • 相关阅读:
    换肤动画
    手风琴动画图
    Ajax传值原理.aspx文档
    三层框架中单表的增删改查
    用ajax传JSON数据
    利用ajax进行post传值,登录QQ和密码代码
    ado.net增删改查及存储过程
    常用的SQL语句
    金融
    写你的简历应该注意什么
  • 原文地址:https://www.cnblogs.com/simly/p/10283496.html
Copyright © 2020-2023  润新知