Atul transport company charges for the parcels from Delhi to Kolkata as per following tariff:
Weight charge / kg
Upto 10 kg Rs. 20
For the next 20 kg Rs. 10
For the next 20 kg Rs. 8
More than 50 kg Rs. 5
WAP to input the weight of parcel and calculate the charges.
Answers
Answered by
9
Answer:
import java.util.Scanner; public class KboatMayurTpt { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter parcel weight: "); double wt = in.nextDouble(); double amt = 0; if (wt <= 10) amt = 30 * wt; else if (wt <= 30) amt = 300 + ((wt - 10) * 20); else amt = 300 + 400 + ((wt - 30) * 15); System.out.println("Parcel Charge = " + amt); } }
Similar questions