didatzi

Market Exchange

Jan 15th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * Created by Deyan Yordanov on 15.1.2017 г..
  5.  */
  6. public class MarketExchange {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         double priceVeg = Double.parseDouble(scanner.nextLine());
  10.         double priceFruit = Double.parseDouble(scanner.nextLine());
  11.         int totalVeg = Integer.parseInt(scanner.nextLine());
  12.         int totalFruit = Integer.parseInt(scanner.nextLine());
  13.  
  14.         double vegetables = priceVeg * totalVeg;
  15.         double fruit = priceFruit * totalFruit;
  16.         double amount = (vegetables + fruit)/1.94;
  17.         System.out.printf("%.13f", amount);
  18.  
  19.     }
  20. }
Add Comment
Please, Sign In to add comment