Advertisement
Spocoman

04. Vegetable Market

Aug 20th, 2024
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class VegetableMarket {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double vegetablesBg = Double.parseDouble(scanner.nextLine());
  7.         double fruitsBg = Double.parseDouble(scanner.nextLine());
  8.         double vegetablesKg = Double.parseDouble(scanner.nextLine());
  9.         double fruitsKg = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double result =(((vegetablesBg * vegetablesKg) + (fruitsBg * fruitsKg)) / 1.94);
  12.  
  13.         System.out.printf("%.2f", result);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement