Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FruitMarket {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double strawberrypriceperkg = Double.parseDouble(scanner.nextLine()); //cena za kilogram
- double amountofthebannanasinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo banani
- double amountoftheorangesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo portokali
- double amountoftheraspberriesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo malini
- double amountofthestrawberriesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo qgodi
- // цената на малините е с 50% по-ниска от тази на ягодите;
- double raspberriesprice = strawberrypriceperkg / 2;
- double raspberriespriceforkg = amountoftheraspberriesinkg * raspberriesprice ;
- // цената на портокалите е с 40% по-ниска от цената на малините;
- double orangespriceforkg = raspberriesprice - raspberriesprice * 40 / 100;
- // цената на бананите е с 80% по-ниска от цената на малините.
- double bannanaspriceforkg = raspberriesprice - raspberriesprice * 80 / 100;
- double strawberriespriceforkg = strawberrypriceperkg * amountofthestrawberriesinkg;//калк количество ягоди*цена
- System.out.println(raspberriespriceforkg + orangespriceforkg + bannanaspriceforkg + strawberriespriceforkg);
- //System.out.println(strawberriesprice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement