/*
* Copyright (c)2013, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称: array.cpp
* 作 者: 李中意
* 完成日期:2014 年7月 7 日
* 版本号: v1.0
* 输入描述:无
*/
#include <iostream>
#include <iomanip>
using namespace std;
class Product
{
public:
Product(){}
Product(int nu,int q,float p):num(nu),quantity(q),price(p){}
int num;
int quantity;
float price;
void total()
{
if(quantity>=10)
{
sum+=quantity*price*0.98*(1-discount);
}
else
{
sum+=quantity*price*(1-discount);
}
// sum+=sum;
n=n+quantity;
}
static float average()
{
return (sum/n);
}
static void display()
{
cout<<sum<<" "<<average()<<endl;
}
private:
static float discount;
static float sum;
static int n;
};
float Product::discount=0.05;
float Product::sum=0;
int Product::n=0;
int main()
{
const int NUM =10;
Product Prod[10];
int m,i;
cin>>m;
int num;
int quantity;
float price;
for(i=0; i<m; i++)
{
cin>>num>>quantity>>price;
Product temp(num,quantity,price);
Prod[i]=temp;
}
for(i=0; i<m; i++)
Prod[i].total();
cout<<setiosflags(ios::fixed);
cout<<setprecision(2);
Product::display();
return 0;
}