Advertisement
Deiancom

Lemon stand

Sep 9th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package EXAM;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Lemonade_Stand_01 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double lemonsKg = Double.parseDouble(scanner.nextLine());
  9.         double sugarKg = Double.parseDouble(scanner.nextLine());
  10.         double waterLiters = Double.parseDouble(scanner.nextLine()) * 1000;
  11.         double lemonJuice = lemonsKg * 980;
  12.         double sugarPercent = sugarKg * 0.30;
  13.         double allLemonJuice = lemonJuice + waterLiters + sugarPercent;
  14.         double cupSold = Math.floor(allLemonJuice / 150);
  15.         double money = cupSold * 1.20;
  16.         System.out.printf("All cups sold: %.0f%n",cupSold);
  17.         System.out.printf("Money earned: %.2f",money);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement