| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 594 人关注过本帖
标题:这个怎么编写
取消只看楼主 加入收藏
wuwenkai
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-10-19
收藏
 问题点数:0 回复次数:0 
这个怎么编写
Write a program that will calculate and print bills for the city power company. The rates vary depending on whether the use is residential, commercial or industrial. A code of R means residential use, a code of C means commercial use and a code of I means industrial use. Any other code should be treated as an error. The rates are computed as follows:
R: ₤4.00 plus ₤0.03 per kwh (kilowatt-hour) used
C: ₤40.00 for the first 1000kwh and ₤0.025 for each additional kwh.
I: Rate varies depending on time of usage:

    Peak Hours:         ₤50.00 for the first 1000 kwh and
                 ₤0.04 for each additional kwh

    Off-Peak Hours:     ₤30.00 for the first 1000 kwh and
                 ₤0.02 for each additional kwh.
Your program should prompt the user to enter an integer account number and the use code (type char). Depending on the account type selected the user should be prompted to provide the consumption figures in whole numbers of kilowatt-hours. The program should display the account number and the amount due from the user.
The calculation of the amount due for each account type should be performed by three functions:
1.    residential: a function that returns a double and takes an input argument of type int This function should be used to compute the bill for residential customers.
2.    commercial: a function that returns a double and takes one input argument of type int. This function should be used to compute the bill for commercial customers.
3.    industrial :  a function that returns a double and takes two input arguments of type int (peak and off_peak). This function should be used to compute the bill for industrial customers.  
 
大哥 大姐们。。这个怎样编写呀。。谢谢啦。。十分感谢
搜索更多相关主题的帖子: 编写 
2008-10-29 11:58
快速回复:这个怎么编写
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039934 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved