A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 冰雪丝阳 中级黑马   /  2015-12-6 23:20  /  532 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

public class MyFruit {

        public static void main(String[] args) {
                int lAccount = 1;
                int aAccount = 2;
                int mAccount = 3;
               
                String lName = "榴莲";
                String aName = "苹果";
                String mName = "猕猴桃";
               
                double lPrice = 32.0;
                double aPrice = 6.5;
                double mPrice = 6.0;
               
                String lUnit = "公斤";
                String aUnit = "公斤";
                String mUnit = "公斤";
               
                int lNum = 2;
                int aNum = 3;
                int mNum = 5;
                char lLevel = 'A';
                char aLevel = 'A';
                char mLevel = 'A';               
                double amount = lPrice * lNum + aPrice * aNum + mPrice * mNum ;
                System.out.println("水果编号    水果名称    水果单价     计价单位    数量    品质");
                System.out.println("  "+lAccount+"    "+lName+"           "+lPrice+"   "+lUnit+"            "+lNum+"   "+lLevel);
                System.out.println("  "+aAccount+"    "+aName+"           "+aPrice+"    "+aUnit+"            "+aNum+"   "+aLevel);
                System.out.println("  "+mAccount+"    "+mName+"      "+mPrice+"    "+mUnit+"            "+mNum+"   "+mLevel);
                System.out.println("      总价:"+amount);
        }

}


0 个回复

您需要登录后才可以回帖 登录 | 加入黑马