Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Import {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double gosti = Integer.parseInt(scan.nextLine());
- double cena = Integer.parseInt(scan.nextLine());
- double budget = Integer.parseInt(scan.nextLine());
- double torta = budget-(budget*0.90);
- double suma = 0;
- if (gosti > 20){
- cena=cena-(cena*0.25);
- suma = gosti*cena+torta;
- if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
- else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}}
- else if (gosti > 15){
- cena=cena-(cena*0.20);
- suma = gosti*cena+torta;
- if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
- else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}
- }
- else if (gosti > 10){
- cena=cena-(cena*0.15);
- System.out.println(cena);
- suma = gosti*cena+torta;
- if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
- else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}
- }
- else {suma = gosti*cena+torta;
- if (suma > budget){System.out.printf("No party! %.2f leva needed.",(budget-suma)*(-1));}
- else {System.out.printf("It is party time! %.2f leva left.",budget-suma);}}
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement