Advertisement
Guest User

new

a guest
Mar 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P15_TailoringWorkshop {
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6.  
  7. int tables = Integer.parseInt(input.nextLine());
  8. double tableLength = Double.parseDouble(input.nextLine());
  9. double tableWidth = Double.parseDouble(input.nextLine());
  10.  
  11. double singleCoveringArea = (tableLength + 0.6) * (tableWidth + 0.6);
  12. double totalCoveringArea = tables * singleCoveringArea;
  13. double KaroSize = tableLength / 2;
  14. double singleKaroArea = KaroSize * KaroSize;
  15. double totalKaroArea = tables * singleKaroArea;
  16.  
  17. double totalCoveringPriceUSD = totalCoveringArea * 7;
  18. double totalCoveringPriceBGN = totalCoveringPriceUSD * 1.85;
  19.  
  20. double totalKaroPriceUSD = totalKaroArea * 9;
  21. double totalKaroPriceBGN = totalKaroPriceUSD * 1.85;
  22.  
  23. double totalPriceUSD = totalCoveringPriceUSD + totalKaroPriceUSD;
  24. double totalPriceBGN = totalCoveringPriceBGN + totalKaroPriceBGN;
  25.  
  26. System.out.printf("%.2f USD%n", totalPriceUSD);
  27. System.out.printf("%.2f BGN", totalPriceBGN);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement