谁能帮我解决航空托运费用计算编程

来源:百度知道 编辑:UC知道 时间:2024/05/15 17:40:58
#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
#define MAXITEM 5
class Cargo{
protected:
char owner[40];
float weight;
char destination[100];
char content[200];
float charge;

static float weightRange[MAXITEM];
static float chargeRange[MAXITEM];

public:
Cargo(char * owner,float weight,char *destination,char *content);
~Cargo(){};

virtual float calcCharge();

char * getOwner();
float getWeight();
char *getDestination();
char *getContent();
float getCharge();
};
float Cargo::weightRange[MAXITEM]={15.0f,25.0f,45.0f,80.0f,500.0f};
float Cargo::chargeRange[MAXITEM]={0.0f,12.0f,15.0f,20.0f,30.0f};

Cargo::Cargo(char *owner,float weight,char *destination,char *content)
{
strcpy(this->owner,owner);

#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h> /*前面都是定义数据库*/
#define MAXITEM 5 /*定义常数5*/
class Cargo{
protected:
char owner[40];
float weight;
char destination[100];
char content[200];
float charge; /*定义*/

static float weightRange[MAXITEM];
static float chargeRange[MAXITEM]; /*定义*/

public:
Cargo(char * owner,float weight,char *destination,char *content); /*定义指针变量*/
~Cargo(){};

virtual float calcCharge(); /*定义函数*/

char * getOwner();
float getWeight();
char *getDestination();
char *getContent();
float getCharge(); /*定义指针变量*/
};
float Cargo::weightRange[MAXITEM]={15.0f,25.0f,45.0f,80.0f,500.0f};
float Cargo::chargeRange[MAXITEM]={0.0f,12.0f,15.0f,20.0f,30.0f}; /*数字*/

Cargo::Cargo(char *owner,float weight,char *destinatio