Advertisement
chaibs

targil4-taxi

Dec 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package myfirst;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class targil4 {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         double first_price = 10.20, km_price = 1.30, tp = 0, user_km = 0;
  10.         int sc_price = 2, user_sc = 0;
  11.  
  12.         Scanner s = new Scanner(System.in);
  13.  
  14.         System.out.println("Please enter how many KM you want to go:");
  15.         user_km = s.nextDouble();//get user km
  16.  
  17.         System.out.println("Please enter how many suitcases you bring:");
  18.         user_sc = s.nextInt();//get user number of suitcases
  19.  
  20.         tp = first_price + (km_price * user_km) + (sc_price * user_sc);
  21.         //first price plus how many km the user need multiply km price + how many suitcase user carry multiply price
  22.  
  23.         System.out.println("Your total price is: " + tp + " ILS");//result
  24.  
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement