Untitled
unknown
java
4 years ago
1.2 kB
4
Indexable
import java.util.Scanner; public class MaidenParty { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double priceParty = Double.parseDouble(scan.nextLine()); int messages = Integer.parseInt(scan.nextLine()); int roses = Integer.parseInt(scan.nextLine()); int keychains = Integer.parseInt(scan.nextLine()); int drawings = Integer.parseInt(scan.nextLine()); int charms = Integer.parseInt(scan.nextLine()); double priceAllThings = (messages * 0.60) + (roses * 7.20) + (keychains * 3.60) + (drawings * 18.20) + (charms * 22); double countThings = messages + roses + keychains + drawings + charms; if(countThings >= 25){ priceAllThings = priceAllThings - (priceAllThings * 0.35); } double hosting = priceAllThings * 0.10; double winnery = priceAllThings - hosting; double diff = Math.abs(winnery - priceParty); if(winnery >= priceParty){ System.out.printf("Yes! %.2f lv left.", diff); } else { System.out.printf("Not enough money! %.2f lv needed.",diff); } } }
Editor is loading...