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();
        }

    }
       
  • 相关阅读:
    Session的配置
    插件编程小窥
    今日遇到了困难,顺便看了下SMO
    初识三层架构
    .NET文件类库
    JQuery学习笔记
    反射整理学习<二>
    通俗道破单例模式
    菜鸟写代码生成器最后一天完结篇
    卧谈会:委托与事件
  • 原文地址:https://www.cnblogs.com/Mfb-/p/12808069.html
Copyright © 2011-2022 走看看