Софтуерно Инженерство
Loading...
shalata avatar shalata 1 Точки

08. Yard Greening

Здравейте! 

Имам проблем със задачата и системата ми дава 70/100. Не мога да разбера къде ми е грешката.

import java.util.Scanner;

    public class YardGreening {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);

            double squareMeters = Integer.parseInt(scanner.nextLine());
            double priceForLandscaping = squareMeters * 7.61;
            double priceForLandscapingDiscount = (0.18 * priceForLandscaping);
            double totalPrice = (priceForLandscaping - priceForLandscapingDiscount);

            System.out.printf("The final price is: %.2f lv.%n", totalPrice);
            System.out.printf("The discount is: %.2f lv.", priceForLandscapingDiscount);


        }

    }
Тагове:
0
Programming Basics with Java
mitkomik avatar mitkomik 10 Точки
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
            double area = Double.parseDouble(scanner.nextLine());
            //"The final price is: {крайна цена на услугата} lv."; 7.61
            //"The discount is: {отстъпка} lv."; 18%
            double price = area * 7.61;
            double disc = price * 0.18;
            double finPrice = price - disc;
            System.out.printf("The final price is: %.2f lv." , finPrice);
            System.out.println("");
            System.out.printf("The discount is: %.2f lv." , disc);
    }
}
0
12/02/2020 13:16:40