JAVA第三次作业

package shan;
import java.util.Scanner;
public class zy {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		float dbz=6.4f;//定义蛋白质
		System.out.println("请输入购买牛奶的盒数:");
		int he=sc.nextInt();//你输入的值
		System.out.print(he);
		System.out.print("袋牛奶含有的蛋白质:"+(he*dbz));
		sc.close();
	}

}

 结果

import java.util.Scanner;
public class zy {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		float je=15.5f;//定义金额
		System.out.println("请输入售出汉堡的数量:");
		int sl=sc.nextInt();//输入数量
		System.out.print("一天总出售的汉堡数量为:"+sl);
		System.out.println("个");
		System.out.print("全天售出的总金额为:"+(je*sl));
		System.out.print("元");
		sc.close();
	}
}

 

import java.util.Scanner;
public class zy{
	
	public static void main (String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入速度:");
		int km=sc.nextInt();//输入速度
		float m =km/3.6f;//1m/s=3.6km/h
		System.out.print(km+"km/h="+m+"m/s");
		sc.close();
		
	}
}

 

import java.util.Scanner;

		
		public class zy{
			
			public static void main (String[] args) {
				// TODO Auto-generated method stub
				
				Scanner sc = new Scanner (System.in);
				int je=2;
				System.out.println("  购票信息");
				System.out.println("-------------");
				System.out.println("目的车站:人民广场");
				System.out.println("票价:"+je+".00");
				System.out.print("购票数量:");
				int s=sc.nextInt();
				System.out.println("应付金额:"+(je*s));
				System.out.print("已付金额:");
				int y=sc.nextInt();
				System.out.print("找零:"+(y-(je*s)));
				sc.close();
			}
	
		}	
	

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值