DTDC a courier company charges for the courier based on the weight of the parcel. Define a class with the following specifications:
Class name: courier
Member variables:
name – name of the customer
weight – weight of the parcel in kilograms
address – address of the recipient
bill – amount to be paid
type – 'D'- domestic, 'I'- international
Member methods:
void accept ( ) — to accept the details using the methods of the Scanner class only.
void calculate ( ) — to calculate the bill as per the following criteria:
| Weight in Kgs | Rate per Kg |
|---|
| First 5 Kgs | Rs.800 |
| Next 5 Kgs | Rs.700 |
| Above 10 Kgs | Rs.500 |
An additional amount of Rs.1500 is charged if the type of the courier is I (International)
void print ( ) — To print the details
void main ( ) — to create an object of the class and invoke the methods