Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /*
- ===============================================
- NoteBook chapter 1: language building stones
- Ex3: Furniture Shipment
- ===============================================
- */
- public class MyProgram {
- public static void main(String[] args) {
- //variables
- final int SHIPMENT_PRICE=5;
- final int FLOOR_PRICE=1;
- final double TIP=0.1;
- Scanner s=new Scanner(System.in);
- int furniturePrice;
- int wight,floor,distance;
- double totalPrice;
- //user input
- System.out.println("Enter furniture price: ");
- furniturePrice=s.nextInt();
- System.out.println("Furniture wight: ");
- wight=s.nextInt();
- System.out.println("Floor: ");
- floor=s.nextInt();
- System.out.println("Distance(km): ");
- distance=s.nextInt();
- //calc total price to pay
- totalPrice=(furniturePrice+(floor*wight*FLOOR_PRICE)+(SHIPMENT_PRICE*distance)+(furniturePrice*TIP));
- System.out.println("total price: "+totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment