PROGRAMMING:Management of book audio and video rental
A book and video store rents books and tapes.
The framework of the following base class is given
class Publication
{
protected:
string title;// name
float price;// original price
int day;// lease term
public:
virtual void display()=0;// Print price list
}
Taking publication as the base class, the book and tape classes are constructed.
To generate the above class and write the main function, the main function should have a base class publication pointer array with no more than 10 elements.
Publication *pp[10];
The main function creates book and tape objects according to the input information.
Their original rent is: lease term * 1.2.
In addition, the actual rent collected does not exceed 2 times the rental valuation.
The valuation of the book is: old and new * original price.
The valuation of tape is as follows: original price / (1 + rental times / 3).
Input format: each test case occupies one line. The first item is the rental type, 1 is book, 2 is tape. The next item is name, original price and lease term. The last item is the degree of old and new (0.1 to 1), and tape is the number of times it has been rented. 0 indicates the end of the input.
It is required to output the name, original rent (1 decimal place after the decimal point). If the original rent is greater than 2 times of the rental valuation, the actual rent to be charged (1 decimal place after the decimal point) will be given at the same time, and R will be marked at the end.
Input sample
1 AAA 19.5 3 0.5
1 BBB 9.5 2 0.1
2 AA 10 2 0
2 DDDD 12.5 2 38
1 FFF 42 3 0.1
0
Output sample
AAA 3.6
BBB 2.4 1.9 R
AA 2.4
DDDD 2.4 1.8 R
FFF 3.6
answer:If there is no answer, please comment
The framework of the following base class is given
class Publication
{
protected:
string title;// name
float price;// original price
int day;// lease term
public:
virtual void display()=0;// Print price list
}
Taking publication as the base class, the book and tape classes are constructed.
To generate the above class and write the main function, the main function should have a base class publication pointer array with no more than 10 elements.
Publication *pp[10];
The main function creates book and tape objects according to the input information.
Their original rent is: lease term * 1.2.
In addition, the actual rent collected does not exceed 2 times the rental valuation.
The valuation of the book is: old and new * original price.
The valuation of tape is as follows: original price / (1 + rental times / 3).
Input format: each test case occupies one line. The first item is the rental type, 1 is book, 2 is tape. The next item is name, original price and lease term. The last item is the degree of old and new (0.1 to 1), and tape is the number of times it has been rented. 0 indicates the end of the input.
It is required to output the name, original rent (1 decimal place after the decimal point). If the original rent is greater than 2 times of the rental valuation, the actual rent to be charged (1 decimal place after the decimal point) will be given at the same time, and R will be marked at the end.
Input sample
1 AAA 19.5 3 0.5
1 BBB 9.5 2 0.1
2 AA 10 2 0
2 DDDD 12.5 2 38
1 FFF 42 3 0.1
0
Output sample
AAA 3.6
BBB 2.4 1.9 R
AA 2.4
DDDD 2.4 1.8 R
FFF 3.6
answer:If there is no answer, please comment