galinyotsev123

ProgBasicsExam11and12August2018-E01shoppingTime

Jan 2nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class E01shoppingTime{
  3.  
  4. public static void main (String[]args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double lunchTime = Double.parseDouble(scanner.nextLine());
  8. double pricePeriferia = Double.parseDouble(scanner.nextLine());
  9. double priceProgram= Double.parseDouble(scanner.nextLine());
  10. double priceFrape = Double.parseDouble(scanner.nextLine());
  11. double frapeTime = 5;
  12. double periferiaTime = 6; //3 x 2min
  13. double programmsTime = 4; //2 x 2min
  14. double Total = priceFrape + (2 * priceProgram) + (pricePeriferia * 3);
  15. double TimeLeft = lunchTime - (frapeTime + periferiaTime + programmsTime);
  16.  
  17. System.out.printf("%.2f%n", Total);
  18. System.out.printf("%.0f", TimeLeft);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment