Swimming Regulations

/* This program is used for calculating each Paralympics Swimming Relay teams disability points and pointing out which teams are legal or not Auther---- Tsotne Gvadzabia Date---- 11/10/16 */ import java.util.Scanner; class relay { public static void main(String[]p) //Main { int score; //Declare score welcome(); score = numbers(); calculate(score); System.exit(0); } public static void welcome() //Welcome method that prints out instructions for the user { System.out.println("Welcome, please follow the instructions and enter the correct disability score for each swimmer (numbers only) to gain the correct answer"); } public static int numbers() //Method where user inputs data { Scanner scanner = new Scanner(System.in); int score =0; for(int i = 1; i<=4; i ++) //For loop Start { int disability; System.out.println("What is the disability class of Swimmer "+i+" ?"); disability = scanner.nextInt(); score = score + disability; } //For loop End return score; //Returns the data inputted by the user } public static void calculate(int score) //Method for using the data that was inputted by the user { if (score<=32) { System.out.println("Your score is:"+ score); System.out.println("Your team is legal"); } else { System.out.println("Your score is:"+ score); System.out.println("Your team is illegal"); } } } //END PROGRAM
A Program for the Paralympic Swimming Relay Teams.

Each Team consists of 4 members and the user must input the "Disability Score" for each member.

If the overall "Disability Score" of the team does not exceed 32 then the team is disqualified as they are unfit for the Paralympic Relay according to the rules and regulations.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.