desislava_topuzakova

PC Store

May 23rd, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. package ExamPrepTwo;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class PCStore {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double priceCPU = Double.parseDouble(scanner.nextLine());
  10. double priceVC = Double.parseDouble(scanner.nextLine());
  11. double priceRam = Double.parseDouble(scanner.nextLine());
  12. int countRam = Integer.parseInt(scanner.nextLine());
  13. double discount = Double.parseDouble(scanner.nextLine());
  14.  
  15. double lvCPU = priceCPU * 1.57;
  16. double discountCPU = lvCPU - (lvCPU * discount);
  17.  
  18. double lvVC = priceVC * 1.57;
  19. double discountVC = lvVC - (lvVC * discount);
  20.  
  21. double lvRam = (priceRam * 1.57) * countRam;
  22.  
  23. double totalSum = discountCPU + discountVC + lvRam;
  24.  
  25. System.out.printf("Money needed - %.2f leva.", totalSum);
  26.  
  27. }
  28. }
Add Comment
Please, Sign In to add comment