/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author lenovo
*/
import java. util.Scanner;
public class InpData {
public static void main(String args[]){
Scanner reader=new Scanner(System.in);//创建对象
int amount=0;
float price=0,sum=0;
System.out.println("please input produce's number:");
amount=reader.nextInt();//输入数量
System.out.println("please inpput price:");
price=reader.nextFloat();//输入价格
sum=price*amount;//计算
System.out.printf("number:%d,price:%5.2f,sum:%5.2f",amount,price,sum);
}
}
输入数据
最新推荐文章于 2021-04-11 21:24:04 发布