One
来源:互联网 发布:中铁二院 知乎 编辑:程序博客网 时间:2024/04/28 23:13
public class TestTriAngle {
public static void main(String[] args) {
TriAngle t = new TriAngle();
t.setBase(5);
t.setHigh(8);
t.info();
}
}
class TriAngle{
private int base;
private int high;
public int getBase() {
return base;
}
public void setBase(int base) {
this.base = base;
}
public int getHigh() {
return high;
}
public void setHigh(int high) {
this.high = high;
}
public void info(){
if( base < 0 || high < 0 ){
System.out.println("输入有误!");
}else{
System.out.println("三角形面积为:"+(base*high)/2);
}
}
}
public static void main(String[] args) {
TriAngle t = new TriAngle();
t.setBase(5);
t.setHigh(8);
t.info();
}
}
class TriAngle{
private int base;
private int high;
public int getBase() {
return base;
}
public void setBase(int base) {
this.base = base;
}
public int getHigh() {
return high;
}
public void setHigh(int high) {
this.high = high;
}
public void info(){
if( base < 0 || high < 0 ){
System.out.println("输入有误!");
}else{
System.out.println("三角形面积为:"+(base*high)/2);
}
}
}
阅读全文
0 0
- One
- one
- one:
- One
- ONE
- one
- one
- one
- one
- one
- one
- One!
- one
- one
- One
- one
- one
- one
- Vue 爬坑之路(三)—— 使用 vue-router 跳转页面
- 【编程题】Java编程题一(10道)
- 通过 PHP 使用China Azure Blob 存储
- 解决Ueditor无法输入的问题
- UINavigationBar添加背景图片的几种简单思路
- One
- kindeditor---在线HTML编辑器
- 【牛客 题库】 如何判断实参变量的个数——>逗号运算符
- Vue 爬坑之路(四)—— 与 Vuex 的第一次接触
- 【第二周项目2】程序的多文件组织
- jqurey $.each与for跳出循环写法
- Leetcode122. Best Time to Buy and Sell Stock II
- java进制、原码、反码、补码、
- C语言中的__FILE__、__LINE__和__func__