JAVA作业

1、输出路线图

package zuoye1;

public class ditie {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.print("北环城站  一匡街  胜利公园  解放大路  工农广场  卫星广场  华庆路\n");
		System.out.print("---|-------|-------|-------|--------|--------|-------|--\n");
		System.out.print(" 庆丰路  长春站北 人民广场  东北师大   繁荣路   市政府   红嘴子");
	}

}

输出结果 

2、输出充值图

package zuoye2;
 
public class chongzhitu {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.print("   长春轨道交通              \n");
		System.out.print("=============================\n");
		System.out.print("车站名称:东环城路\n"
					   + "设备编号:02390704\n"
					   + "票卡编号:03104890010014699002\n"
					   + "车票类型:本机购卡(TRANSPORTAIONCARD)\n"
					   + "充值时间:2018-10-03 11:32:15\n"
					   + "交易前金额:19.50元\n"
					   + "充值金额(现金):100.00元\n"
					   + "充值后金额:119.50元");
	}
 
}

3、输出对联

package zuoye3;
 
public class zuoye3 {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.print("				  福星高照		\n"
				+ "			万			  一\n"
				+ "			事			  帆\n"
				+ "			如			  风\n"
				+ "			意			  顺\n"
				+ "			步			  年\n"
				+ "			步			  年\n"
				+ "			高			  好");
	}
 
}

 

 4、文字描述算法

 
public class liti35 {
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		double height = 1.72;     //身高变量, 单位:米  
		int weight = 58;          //体重变量, 单位:千克
		double exponent = weight / (height * height);
		System.out.println("身高为:" + height);
		System.out.println("体重为:" + weight);
		System.out.println("BMI指数为:" + exponent);
		System.out.println("您的体重属于:");
		if(exponent < 18.5) {
			System.out.print("体重过轻");
		}
		if(exponent >= 18.5 && exponent < 24.9) {
			System.out.println("正常范围");
			
		}
		if(exponent >= 24.9 && exponent < 29.9) {
			System.out.println("体重过重");
			
		}
		if(exponent >= 29.9) {
			System.out.println("肥胖");
		}
	}
 
}

1:定义一个double变量height存储身高赋值为1.72

2:定义一个int变量weight存储体重赋值为58

3:定义一个double变量exponent存储BMI公式计算结果

4:打印输出赋予身高height的值

5:打印输出赋予体重weight的值

6:打印输出BMI计算后赋予exponent的值

7:打印输出判断结果

8:判断,如果exponent小于18.5,则第七步输出结果显示“体重过轻”

9:判断,如果exponent大于18.5并且小于24.9,则第七步输出结果显示“正常范围”

10:判断,如果exponent大于24.9并且小于29.9,则第七步输出结果显示“体重过重”

11:判断,如果exponent大于29.9,则第七步输出结果显示“肥胖”

 

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值