package hello; import java.util.Scanner; public class YuanZhu { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); Yuanzhu1 cys = new Yuanzhu1(in.nextInt(), in.nextInt()); System.out.println("圆柱的半径是: " + cys.getR() + " 圆柱的高是: " + cys.getHigh()); System.out.println("圆柱的表面积是: " + cys.biaoArea() + " 圆柱的体积是: " + cys.tiji()); } } class Yuanzhu1 { double r, high; public Yuanzhu1(double r, double high) { this.r = r; this.high = high; } public double getR() { return r; } public void setR(double r) { this.r = r; } public double getHigh() { return high; } public void setHigh(double high) { this.high = high; } public double diArea() { return r * r * Math.PI; } public double biaoArea() { return 2 * diArea() + r * 2 * high * Math.PI; } public double tiji() { return diArea() * high; } }