Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ExemplaryExam_StadiumIncome {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numberSectors = Integer.parseInt(scanner.nextLine());
- int capacityStadium = Integer.parseInt(scanner.nextLine());
- double priceTicket = Double.parseDouble(scanner.nextLine()); // Тук се въвеждат и реални числа, тоест int не ни върши работа.
- double incomePerSector = (capacityStadium * priceTicket) / numberSectors;
- double totalIncome = incomePerSector * numberSectors;
- double charity = (totalIncome - (incomePerSector * 0.75)) / 8;
- System.out.printf("Total income - %.2f BGN", totalIncome); // Грешно използване на printf
- System.out.println();
- System.out.printf("Money for charity - %.2f BGN", charity); // Отново грешно използване на printf
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement