zoukankan      html  css  js  c++  java
  • 第九周作业。

    1.

    package jv;

    public class zuoye {
        int x;
        int y;

        Point() {

        }

        Point(int x0, int y0) {
            this.x = x0;
            this.y = y0;
        }

        public void movePoint(int dx, int dy) {
            this.x += x;
            this.y += y;
            System.out.println("坐标" + this.x + "," + this.y);
        }
    }

    2.

    package jv;
     
    public class zuoye {
        private int length;
        private int width;
     
        Rectangle_func(int length, int width) {
            this.length = length;
            this.width = width;
        }
     
        public void showAll() {
            System.out.println("矩形长为:" + length + " " + "矩形的宽为:" + width);
            System.out.println("矩形的面积为:" + getArea() + " " + "矩形的周长为:" + getPer());
        }
     
        public int getPer() {
            return 2 * (length + width);
        }
     
        public int getArea() {
            return length * width;
        }
     
    }
    package jv;
     
    public class zuoye {
     
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Rectangle_func r = new Rectangle_func(4, 6);
            r.showAll();
        }
     
    }
     
    3.
    package jv;

    public zuoye {
        char color;
        int cpu;
        Macbook() {

        }
        Macbook(char color, int cpu) {
            this.color = color;
            this.cpu = cpu;
        }
        void a() {
            System.out.println("颜色:" + color + "  型号:" + cpu);
        }
    }
    4.
    package jv;

    public class zuoye{
        String name;
        double height;
        int weight;
        int age;

        public void sayHello() {
            System.out.println("hello my name is   " + name + "  height是" + height + "  weight是" + weight);
        }
        public void Person1(String name,int age) {
            System.out.println("姓名是"+name+"年龄是"+age);
        }
    }
    package jv;

    public class zuoye {

        public static void main(String[] args) {
            // TODO 自动生成的方法存根
            Person2 P = new Person2();
            Person2 p1 = new Person2();
            P.name = "wangwu";
            P.height = 1.73;
            P.weight = 66;
            P.sayHello();
            P.Person1("zhansan", 23);
            p1.name = "lishi";
            p1.height = 1.74;
            p1.age = 44;
            p1.weight=55;
            p1.sayHello();
        }

    }
       
  • 相关阅读:
    Oracle 系统表大全
    oracle高效分页存储过程(百万数据级)
    PowerDesigner中name与comment互相转换脚本
    一些web开发中常用的、做成cs文件的js代码
    Ado.net Entity Model 模板出错的修复
    做ssl通道时遇到“请求被中止: 未能创建 SSL/TLS 安全通道”问题的解决方法
    SQLSERVER 2008空间数据库学习(一)
    jquery的全选、全不选、反选例子
    win7 64位下使用oracle ado.net entity framework
    半角/全角互换的代码
  • 原文地址:https://www.cnblogs.com/Mfb-/p/12808069.html
Copyright © 2011-2022 走看看