Advertisement
desislava_topuzakova

01.Christmas Preparation

Feb 25th, 2018
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class demo1 {
  5.     public static void main(String[] agrs) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         int paper = Integer.parseInt(scanner.nextLine());
  9.         int fabric = Integer.parseInt(scanner.nextLine());
  10.         double glue = Double.parseDouble(scanner.nextLine());
  11.         int discount = Integer.parseInt(scanner.nextLine());
  12.  
  13.         double paperPrice = paper * 5.80;
  14.         double fabricPrice = fabric * 7.20;
  15.         double gluePrice = glue * 1.20;
  16.  
  17.         double totalSum = paperPrice + fabricPrice + gluePrice;
  18.  
  19.         //36.20 – ((36.20 * 25) / 100) = 27.150
  20.  
  21.         double result = totalSum - ((totalSum * discount) / 100);
  22.  
  23.         System.out.printf("%.3f", result);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement