borkins

Exam 26-Mar-2016 - 01. Vegetables Market

May 14th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. /**
  2.  * Project: Exam_26_March_2016 - created by borkins on 2017-05-14.
  3.  */
  4.  
  5. import java.text.DecimalFormat;
  6. import java.util.Scanner;
  7.  
  8. public class _01_VegetablesMarket
  9. {
  10.     public static void main(String[] args)
  11.     {
  12.         Scanner console = new Scanner(System.in);
  13.         DecimalFormat df = new DecimalFormat(".#############");
  14.        
  15.         double vegPriceKg = Double.parseDouble(console.nextLine());
  16.         double fruPriceKg = Double.parseDouble(console.nextLine());
  17.         int vegetablesKg = Integer.parseInt(console.nextLine());
  18.         int fruitsKg = Integer.parseInt(console.nextLine());
  19.        
  20.         double vegProfits = vegetablesKg * vegPriceKg;
  21.         double fruProfits = fruitsKg * fruPriceKg;
  22.         double profitsEuro = (vegProfits + fruProfits) / 1.94;
  23.        
  24.         System.out.println(df.format(profitsEuro));
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment