avatar
w*2
1
问题如下:
Write a program to create a customer's bill for a company. The company sells
only five different products: TV, VCR, Remote Controller, CD Player and
Tape Recorder. The unit prices are $400.00, $220, $35.20, $300.00 and $150.
00 respectively. The program must read the quantity of each piece of
equipment purchased from the keyboard. It then, calculates the cost of each
item, the subtotal and the total cost after an 8.25% sales tax. The input
data consists of a set of integers representing the quantities of each item
sold. These integers must be input into the program in a user-friendly way;
that is, the program must prompt the user for each quantity as shown below-
Enter the quantity of TVs sold: 2
Enter the quantity of VCRs sold: 1
Enter the quantity of remote controls sold: 4
Enter the quantity of CD players sold: 1
Enter the quantity of tape recorders sold: 2
QTY DESC PRICE TOTAL
2 Television $400.00 $800.00
1 VCR $220.00 $220.00
4 Remote Control $35.20 $140.80
1 CD Player $300.00 $300.00
2 Tape Recorder $150.00 $300.00

Subtotal: $1760.80
Tax (8.25%): $145.27
Total: $1906.07
Define constants for the unit prices and the tax rate. Use integer variables
to store the quantities for each item. Use floating-point variables to
store the total price of each item, the bill subtotal, the tax amount and
the total amount of the bill. Run your program two times with the following
data:
Set 1 -> 2 1 4 1 2
Set 2 -> 3 0 2 0 21
Format the output adequately showing the 4 columns (QTY, DESCRIPTION, UNIT
PRICE, TOTAL PRICE) in a single row. Use System.out.printf for output.
Use static functions for this problem.
该如何写代码?
求解,不剩感激
avatar
t*c
3
作业吧?无语。。。
avatar
h*s
4
要是整首歌都小新唱,肯定很不错啊。
avatar
U*A
5
难道还在德州?8.25%的税率
avatar
Y*e
6
avatar
Y*e
7
周杰伦 - 彩虹
作曲:周杰伦 作词:周杰伦
哪里有彩虹告诉我
能不能把我的愿望还给我
为什么天这么安静
所有云都跑到我这里
有没有口罩一个给我
释怀说了太多就成真不了
也许时间是一种解药
也是我现在正服下的毒药
看不见你的笑 我怎么睡得着
你的身影这么近我却抱不到
没有地球太阳还是会绕
没有理由我也能自己走
你要离开 我知道很简单
你说依赖 是我们的阻碍
就算放开 那能不能别没收我的爱
当作我最后才明白
有没有口罩一个给我
释怀说了太多就成真不了
也许时间是一种解药
也是我现在正服下的毒药
看不见你的笑 我怎么睡得着
你的身影这么近我却抱不到
没有地球太阳还是会绕
没有理由我也能自己走
你要离开 我知道很简单
你说依赖 是我们的阻碍
就算放开 那能不能别没收我的爱
当作我最后才明白
看不见你的笑
要我怎么睡得着
你的身影这么近我却抱不到
没有地球太阳开始环绕环绕
没有理由我也能自己走掉
是我说了太多就成真不了
也许时间是一种解药解药
也是我现在正服下的毒药
你要离开 我知道很简单
你说依赖 是我们的阻碍
就算放开 那能不能别没收我的爱
当作我最后才明白
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。