03.Courier Express- Programming Basics - Exam
import java.util.Scanner;
public class CourierExpress {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
double weight = Double.parseDouble(console.nextLine());
String typeCourier = console.nextLine();
int distance = Integer.parseInt(console.nextLine());
double allPrice = 0.0;
if (typeCourier.equals("standard")){
if (weight < 1){
allPrice = distance * 0.03;
} else if (weight >=1 && weight <=10){
allPrice = distance * 0.05;
} else if (weight >=11 && weight <=40){
allPrice = distance * 0.10;
} else if (weight >= 41 && weight <=90){
allPrice = distance *0.15;
} else if (weight >= 91 && weight <=150){
allPrice = distance * 0.20;
}
} else if (typeCourier.equals("express")){
if (weight < 1){
allPrice = allPrice + 0.8 * 0.03 *distance * weight;
} else if (weight >=1 && weight <=10){
allPrice = allPrice + 0.4 * 0.05 *distance * weight;
} else if (weight >=11 && weight <=40){
allPrice = allPrice + 0.05 * 0.10 *distance * weight;
} else if (weight >=41 && weight <=90){
allPrice = allPrice + 0.02 * 0.15 * distance * weight;
} else if (weight >=91 && weight <=150){
allPrice = allPrice + 0.01* 0.20 *distance * weight;
}
}
System.out.printf("The delivery of your shipment with weight of %.3f kg. would cost %.2f lv.",weight,allPrice);
}
}
Това е моето решение но, Judge ми дава 50/100 , някой ако може да ми каже къде ми е грешката , защотото не мога да я намеря.Благодаря Предварително !
Благодаря , да условието не е от най - точните и разбиращи се.