| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 384 人关注过本帖
标题:求解一题面向对象的题目
只看楼主 加入收藏
neil86918
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-4-10
结帖率:0
收藏
 问题点数:0 回复次数:0 
求解一题面向对象的题目
小弟刚接触C++ OOP程序 希望各位能给点提示 谢谢

The file, bill.dat contains information related to a customer’s account number and its 6-month bill amount. The data is stored one per line, i.e. account number followed by the bill of each month. A sample of the data is as shown below.
123  (AccountNumber)
10   (6 months bill)
20
30
40
50
60
.
.
.
.
124
11
12
13
14
15
16

Customer Class Specification
class Customer
{
private:
int acctNo;
double billAmt;
public:
Customer(void);
int getAcctNo(); // return acctNo
void setAcctNo(int); // set acctNo to the given value
double getBillAmt(); // return billAmt
void setBillAmt(double); // set billAmt to the given value
};

(a) Write code to implement the Customer Class


(b) Write a main program that fulfils the following requirements:
1. reads the data from the file, bill.dat
2. populates the array of Customers with the read-in data
3. display the account number and total bill of this array of Customers.
For this program, you may assume that there are only 5 customers. A sample screen is as shown below. You are expected to write code to format the display.
Billing Summary
===============
Account Number Total Bill Amount
123    $210
124    $81
125    $141
126    $330
搜索更多相关主题的帖子: 求解 对象 
2010-04-14 13:59
快速回复:求解一题面向对象的题目
数据加载中...
 
   



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

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