Untitled
unknown
plain_text
a year ago
1.2 kB
2
Indexable
Never
11. Rage Expenses import java.util.Scanner; public class Zadatak_15_Judge_Exercise_11 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int lostGamesCount=Integer.parseInt(sc.nextLine()); double headsetPrice=Double.parseDouble(sc.nextLine()); double mousePrice=Double.parseDouble(sc.nextLine()); double keyboardPrice=Double.parseDouble(sc.nextLine()); double displayPrice=Double.parseDouble(sc.nextLine()); double headsetTotal=-1; double mouseTotal=-1; double keyboardTotal=-1; double displayTotal=-1; if(lostGamesCount%2!=0){ headsetTotal=headsetPrice*(lostGamesCount/2); } if(lostGamesCount%3!=0){ mouseTotal=mousePrice*(lostGamesCount/3); } if(lostGamesCount%6!=0){ keyboardTotal=keyboardPrice*(lostGamesCount/6); } if(lostGamesCount%12!=0){ displayTotal=displayPrice*(lostGamesCount/12); } double expenses=headsetTotal+mouseTotal+keyboardTotal+displayTotal; System.out.printf("Rage expenses: %.2f USD.", expenses); } }