Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myfirst;
- import java.util.Scanner;
- public class targil4 {
- public static void main(String[] args) {
- double first_price = 10.20, km_price = 1.30, tp = 0, user_km = 0;
- int sc_price = 2, user_sc = 0;
- Scanner s = new Scanner(System.in);
- System.out.println("Please enter how many KM you want to go:");
- user_km = s.nextDouble();//get user km
- System.out.println("Please enter how many suitcases you bring:");
- user_sc = s.nextInt();//get user number of suitcases
- tp = first_price + (km_price * user_km) + (sc_price * user_sc);
- //first price plus how many km the user need multiply km price + how many suitcase user carry multiply price
- System.out.println("Your total price is: " + tp + " ILS");//result
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement