Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SwimmingChampionship_02 {
- public static void main(String[] args) {
- Scanner scan =new Scanner(System.in);
- /*
- 3
- 400
- 5
- 70.6
- 15.0
- 100.6
- 300.59
- 250.9
- */
- int daysCompetition =Integer.parseInt(scan.nextLine());//3
- int pointsCoveredTotal =Integer.parseInt(scan.nextLine());//400
- int countSwimmers =Integer.parseInt(scan.nextLine());//5
- double hotelRoomPrice =Double.parseDouble(scan.nextLine());//70.6
- double feeSwimmerToParticipate=Double.parseDouble(scan.nextLine());//15.0
- Double moneyToPay =(hotelRoomPrice + feeSwimmerToParticipate)*(double) countSwimmers; // expenses for each day team
- double totalPoints=0; //track of points team has won
- for (int day = 1; day <= daysCompetition; day++) {
- double pointsPerDay=Double.parseDouble(scan.nextLine());
- totalPoints =totalPoints +pointsPerDay;
- if(day>1){
- totalPoints+=pointsPerDay+(pointsPerDay*0.05);
- }
- }
- if(totalPoints>=pointsCoveredTotal){
- moneyToPay =moneyToPay-(moneyToPay*0.25);
- System.out.println("Money left to pay:"+ moneyToPay+ "BGN");
- System.out.println("The championship was successful!");
- } else{
- moneyToPay=moneyToPay-(moneyToPay*0.10);
- System.out.println("Money left to pay:"+ moneyToPay+"BGN");
- System.out.println("The championship was not successful!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement