⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 corp.java

📁 an application that demonstrates the process of inheritance in java
💻 JAVA
字号:
import java.util.*;
import javax.swing.*;
import java.lang.Math;
class punct
{
	public int x1,y1,x2,y2;
	public punct()
	{
		String str4 = JOptionPane.showInputDialog("Dati x1");
		x1 = Integer.parseInt(str4);
		String str5 =  JOptionPane.showInputDialog("Dati y1");
		y1 = Integer.parseInt(str5);
		String str6 =  JOptionPane.showInputDialog("Dati x2");
		x2 = Integer.parseInt(str6);
		String str7 =  JOptionPane.showInputDialog("Dati y2");
		y2 = Integer.parseInt(str7);
	}
}
class segment extends punct
{
	public double lung;
	public segment()
	{
		super();
		lung = Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2));
	}
	public void afisare1()
    {
		System.out.println("Lungimea = "+lung);
	}
}
class suprafata extends segment
{
	public double S;
	public suprafata()
	{
			super();
			S = lung*lung;
	}
	public void afisare2()
	{
		System.out.println("Suprafata = "+S);
	}
}
class volum extends suprafata
{
	public double V;
	public volum()
	{
		super();
		V = S*lung;
	}
	public void afisare3()
	{
		System.out.println("Volum = "+V);
	}
}
class corp
{
	public static void main(String args[])
	{
		volum vol = new volum();
		vol.afisare3();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -