Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         getPrice(34,4);
  4.     }
  5.  
  6.     private static void getPrice(int cost,int hour){
  7.         int price = 0;
  8.         int hours = 0;
  9.         if (cost>=8 && 7*hour<=60){
  10.             for (int i=0;i<30;i++){
  11.                 if (hours>=40){
  12.                     price+= (cost*1.5)*hour;
  13.                 }else
  14.                     price+= cost*hour;
  15.                 hours += hour;
  16.             }
  17.         }
  18.  
  19.         System.out.println(price + " $");
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement