The Delta Inc., a local shipping company is all set to offer low-cost shipping services this Christmas season all tax inclusive. The postage is based on the weight of the package and the speed of delivery. Help them write a postage calculator program for their automated postage calculator self-service machine.

Program

Given the weight of a package in grams, determine the cost of the postage.

Input

  • The weight of the package in grams.
  • The delivery option (Next Day, Speed Post 2 day or Regular 3-5 day).

Output 

  • The cost of postage in dollars and cents required to sent the package.

Assumptions

  •  Max weight is <= 1000 grams and the weight is rounded to the nearest whole number value.

Requirement

The postage is calculated based on weight as follows:

Package (weight in grams)
Postage (cost in cents)
up to 50 grams
100c
up to 100 grams
180c
up to 250 grams
250c
up to 500 grams
50c for every 50 grams or less on top of the base price of 250c.
up to 1000 grams
25c for every 50 grams or less on top of the base price of 500c.

Depending on choose delivery option, the postage cost is increased as followed:

Delivery Option
Code
Cost (in cents)
Next Day
N
550c
Speed Post 2 Day
S
325c
Regular 3-5 Day
R
50c

  Always display the postal code with two-digit cents value even if the postal cost is an exact dollar amount e.g. $12 should be displayed as $12.00.

Test cases

No
Input (Weight in grams)
Input (Delivery Option Code)
Output (Result)
1
25
R
1.50
2
87
N
6.80
3
156
S
5.75
4
325
S
6.25
5
601
R
6.25
6
1000
N
13.00

Instructions 

  • Accept the two whole numbers as input via the command line arguments. The first one is the weight in grams and the other is the delivery option code.
  • Write the logic to compute the postage.
  • Display the cost in dollar and cents.