desislava_topuzakova

05. Yard Greening

Oct 24th, 2021
602
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class YardGreening_05 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double sqMeters = Double.parseDouble(scanner.nextLine());
  7.         double pricePerMeter = 7.61;
  8.  
  9.         //обща цена = кв. метри * 7.61
  10.         //отстъпка = 18% от обща цена
  11.         //крайна цена = обща цена - отстъпка
  12.  
  13.         double totalSum = sqMeters * pricePerMeter;
  14.         double discount = 0.18 * totalSum;
  15.         double finalSum = totalSum - discount;
  16.  
  17.         System.out.printf("The final price is: %f lv.%n", finalSum);
  18.         System.out.printf("The discount is: %f lv.", discount);
  19.     }
  20. }
  21.  
RAW Paste Data