Advertisement
Lyubohd

Stadium Income

Jan 20th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ExemplaryExam_StadiumIncome {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int numberSectors = Integer.parseInt(scanner.nextLine());
  8.         int capacityStadium = Integer.parseInt(scanner.nextLine());
  9.         double priceTicket = Double.parseDouble(scanner.nextLine()); // Тук се въвеждат и реални числа, тоест int не ни върши работа.
  10.  
  11.         double incomePerSector = (capacityStadium * priceTicket) / numberSectors;
  12.         double totalIncome = incomePerSector * numberSectors;
  13.         double charity = (totalIncome -  (incomePerSector * 0.75)) / 8;
  14.  
  15.         System.out.printf("Total income - %.2f BGN", totalIncome); // Грешно използване на printf
  16.         System.out.println();
  17.         System.out.printf("Money for charity - %.2f BGN", charity); // Отново грешно използване на printf
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement