商店销售某一商品,每天公布统一的折扣(discount)。同时允许销售人员在销售时灵活掌握售价(price),在此基础上,一次购10件以上者,还可以享受9.8折优惠。现已知当天3个销售员销售情况。。。。。请编写程序,计算当日此商品的总销售款sum和每件商品的平均售价。要求用静态数据成员和静态成员函数。
#include<iostream>
using namespace std;
//因为浮点型常数默认是Double型,而代码中都是用float型小数,所以在数字后面加上f
class Product
{
public:
Product(int n,int q,float p):num(n),quantity(q),price(p){};
void total();
static float average();
static void display();
private:
int num;
int quantity;
float price;
static float discount;
static float sum;
static int n;
};
void Product::total()
{