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

    1.package asdd;
    
    public class sasa {
        int x;
        int y;
         public Point() {}
             public Point(int x0,int y0){
                 this.x=x0;
                 this.x=y0;
             }
             public void  movePoint(int dx,int dy){
                 System.out.printf("移动前点的坐标为(x:%d,y:%d)
    ",this.x,this.y);
                 System.out.printf("移动量为(x:%d,y:%d)
    ",dx,dy);
                 this.x+=dx;
                 this.y+=dy;
                 System.out.printf("移动点后的坐标(x:%d,y:%d)
    ",this.x,this.y);
             }
             
         
    
    }
    2.package asdd;
    
    public class sasa {
        int x;
        int y;
         public Point() {}
             public Point(int x0,int y0){
                 this.x=x0;
                 this.x=y0;
             }
             public void  movePoint(int dx,int dy){
                 System.out.printf("移动前点的坐标为(x:%d,y:%d)
    ",this.x,this.y);
                 System.out.printf("移动量为(x:%d,y:%d)
    ",dx,dy);
                 this.x+=dx;
                 this.y+=dy;
                 System.out.printf("移动点后的坐标(x:%d,y:%d)
    ",this.x,this.y);
             }
             
         
    
    }
    package asdd;
    public class sasa {
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Rectangle rc = new Rectangle(5,6);
            rc.showAll();
        }
    }
    3.package asdd;
    public class sasa {
        char color;
        int cpu;
    
        public void getDate() {
    
        }
    
        public void getDate(char color, int cpu) {
            this.color = color;
            this.cpu = cpu;
    
        }
    
        void showAll() {
            System.out.println("颜色为" + color + ",cpu型号为" + cpu);
        }
    
    }
    package asdd;
    public class sasa {
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Computer cp = new Computer();
            cp.getDate('黑', 8750);
            cp.showAll();
        }
    }
    6.package asdd;
    public class sasa {
        String name;
        int age;
        double height;
    
        public void sayHello() {
            System.out.println("hello,my name is " + this.name);
        }
    
        public void getValue(String name, int age, double height) {
            this.name = name;
            this.age = age;
            this.height = height;
        }
    
    }
    package asdd;
    public class  sasa{
    public static void main(String[] args) {
            // TODO Auto-generated method stub
            Person p1 = new Person();
            p1.getValue("zhangsan", 33, 1.74);
            p1.sayHello();
            Person p2 = new Person();
            p2.getValue("lishi", 44, 1.74);
            p2.sayHello();
    
        }
  • 相关阅读:
    AE 线编辑
    ArcEngine判断要素(feature)是否为multipart feature及分解(炸开)代码
    AE二次开发技巧之撤销、重做
    ArcEngine数据编辑--选择要素
    java语言体系的技术简介之JSP、Servlet、JDBC、JavaBean(Application)
    MVC开发模式详解
    数据库设计中常见表结构的设计技巧
    Eclipse 保存文件时自动格式化代码
    优化你的java代码性能
    Hibernate 与mybatis的区别
  • 原文地址:https://www.cnblogs.com/csy521/p/12808334.html
Copyright © 2011-2022 走看看