kalin729

Fruit Market

Mar 7th, 2021
391
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main2 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner s = new Scanner(System.in);
  9.  
  10.         double strawberryPrice = Double.parseDouble(s.nextLine());
  11.         double bananas = Double.parseDouble(s.nextLine());
  12.         double oranges = Double.parseDouble(s.nextLine());
  13.         double raspberries = Double.parseDouble(s.nextLine());
  14.         double strawberries = Double.parseDouble(s.nextLine());
  15.  
  16.         double raspberryPrice = strawberryPrice * 0.5;
  17.         double orangePrice = raspberryPrice * 0.6;
  18.         double bananaPrice = raspberryPrice * 0.2;
  19.  
  20.         double sum = (strawberries * strawberryPrice) + (raspberries * raspberryPrice) + (bananas * bananaPrice) + (oranges * orangePrice);
  21.         System.out.printf("%.2f", sum);
  22.  
  23.     }
  24.  
  25. }
  26.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×