admin 管理员组文章数量: 1184232
2024年3月11日发(作者:java虚拟机的gc机制有哪些优缺点)
1 package org. open. java;
2
3/**
4*任务1
5 * @author chenjunfeng02
6 *
7 */
8 public class FinalExam1 {
9 private float waterPrice = 3.0f; //矿泉水
10 private float breadPrice = 3.5f; //面包
11 private float icecreamPrice = 2.5f; //冰棍.
12 private float fastFoodPrice = 4.5f; //方便面
13 private float cocaColaPrice = 3.5f; //瓶装可乐
14
15 public FinalExam1() {
16
17 }
18
19 /**
20 *计算购物的总价格
21 *
22 * @param water矿泉水的数量
23 * @param bread 面包的数量
24 * @param icecream 冰棍的数量
25 *@return
26 */
27 public float calcPriceByXiaoMing(int waterNum, int breadNum, int cocaColaNum) {
28 System. out. println("==========小明购买的产品列表===============");
29 System. n("矿泉水: " + waterNum);
30 System. n("面包:" + breadNum) ;
31 System. n("瓶装可乐:" + cocaColaNum) ;
32
33 float totalPrice = waterNum * waterPrice +
34 breadNum * breadPrice + cocaColaNum * this. cocaColaPrice;
版权声明:本文标题:国开《JAVA语言程序设计》形考任务三源代码及输出截图 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1710093358a557395.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论