Facebook
From Cute Gorilla, 3 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 137
  1. import java.util.Scanner;
  2.  
  3. public class HelloSoftuni {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double strawberryPricePerKilo = Double.parseDouble(scanner.nextLine());
  8.         double bananaKg = Double.parseDouble(scanner.nextLine());
  9.         double orangeKg = Double.parseDouble(scanner.nextLine());
  10.         double raspberryKg = Double.parseDouble(scanner.nextLine());
  11.         double strawberryKg = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double raspberryPrice = strawberryPricePerKilo - (strawberryPricePerKilo * 0.5);
  14.         double orangePrice = raspberryPrice - (raspberryPrice * 0.4);
  15.         double bananaPrice = raspberryPrice - (raspberryPrice * 0.8);
  16.  
  17.         double finalPrice = strawberryKg * strawberryPricePerKilo + bananaKg * bananaPrice
  18.                 + orangeKg * orangePrice + raspberryKg * raspberryPrice;
  19.  
  20.         System.out.printf("%.2f", finalPrice);
  21.     }
  22. }

Replies to Untitled rss

Title Name Language When
Re: Untitled Funky Leopard java 3 Years ago.