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

    package Wxte;
    
    public class Rectangle {
    	 double length;
    	    double width;
    	    public void getArea() {
    	        System.out.println("面积="+length*width);
    	    }
    	     
    	    public void getPer() {
    	        System.out.println("周长"+(length+width)*2);
    	    }
    	     
    	    public void showAll() {
    	        System.out.println("长="+length);
    	        System.out.println("宽="+width);    
    	        getArea();
    	        getPer();
    	    }
    }
    

      

    package Wxte;
    
    import java.util.Scanner;
    
    public class Mask {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		 Rectangle b = new Rectangle();
             Scanner input = new Scanner(System.in);
             System.out.print("输入长:");
             b.length = input.nextInt();
             System.out.print("输入宽:");
             b.width = input.nextInt();
             b.showAll();
        }
    
    
    
    	}
    

      

  • 相关阅读:
    Swift
    Swift
    Swift
    Swift
    Swift
    Swift
    Swift
    C++生产和使用的临时对象
    RecyclerView0基于使用
    Docker创建MySQL集装箱
  • 原文地址:https://www.cnblogs.com/575757ljp--/p/12744251.html
Copyright © 2011-2022 走看看