Advertisement
ivobora

Stadium Income 1 task

Apr 15th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Test {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         int sectorCount = Integer.parseInt(scanner.nextLine());
  9.         int stadiumCapacity = Integer.parseInt(scanner.nextLine());
  10.         double ticketPrice = Double.parseDouble(scanner.nextLine());
  11.  
  12.  
  13.         double sumPrice = stadiumCapacity * ticketPrice;
  14.         double oneSectorPrice = sumPrice / sectorCount;
  15.         double charityMoney = (sumPrice - (oneSectorPrice * 0.75)) / 8;
  16.  
  17.         System.out.printf("Total income - %.2f BGN\n", sumPrice);
  18.         System.out.printf("Money for charity - %.2f BGN", charityMoney);
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement