Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program, should begin with // Full Name: // Part time or Full Time // Class List No: // Tutorial Group (-0.1 mark if

imageimageimageimageimageimageimageimageimageimageimageimage

Your program, should begin with // Full Name: // Part time or Full Time // Class List No: // Tutorial Group (-0.1 mark if no class list no) // Declaration: ...... tell me if it is your own work .... And whether you have // passed your program to your friends or have referred someone's work Objectives - Selection and Repetition control structures Classes and objects Instance and static methods The use of arrays and ArrayList's Task: (5 marks) I like to watch the Miss or Mr. World TV program. When you see the most beautiful ladies or the most handsome men in the world walking and showing off their beautifulness on stage, how nice! Of course, judges play an important role in the competition. The judges enter their scores, secretly to the computer system; usually some best and some lowest scores are eliminated; the sum of the un-eliminated scores is the score of the competent. In this assignment, we will design a system for Miss World competition. Miss World competition involves in three qualifying rounds: interview, swimsuit, and evening gown competitions. The best 5, probably, will enter to the final round to decide the final winners; but we are only interested in the qualifying round for this assignment to decide the ranking of all the beautiful ladies representing their countries. Let us look at a simple UML diagram for this assignment: MissWorld Country +static int SIZE YourName_A3 -String name -String missName 1.1 name -Country name -final String Countries -int age -double score -double cf 1..1 1..1 - -final String Titles -double fs Three classes: Country class, MissWorld class and a main class. We will look at their details later. Convenient to your design, additional class(es) and methods is/are allowed; additional instance variables ARE NOT ALLOWED. Let us now look at the detail of each class. Basically each class has private instance variables, constructors, accessor methods, mutator methods and some other methods related to the class(es). Methods are either public or private; you should specify them clearly in your implementation. Let us start with the Country class: -String name -String missName -int age Country +Country(String name, String missName, int age) + String getName() +String getMissName() +int getAge +void setInfo(String name, String missName, int age) It is a simple class consisting of three private instance variables: name (of a country), missName (name of contestant) and age (of contestant). A constructor to initialize the instance variables, some accessor methods and a mutator method. Additional methods are allowed. Additional instance variables or any change to instance variables are not allowed. 2 Next, let us look at the MissWorld class which is the most important class of this assignment: MissWorld +static int SIZE -Country name -double score -double cf -double fs +MissWorld (Country name, double score, double cf) +Country getCountry() +double getCarriedForward() +double getFinalScore( -ArrayList getSortedList() -double highest() -double second Highest) -double lowest() -double secondLowest) -double finalScore) +double getTotalScore( +void printinfo This class has a constant SIZE indicating the number of judges, usually is 10. By specifying it as a constant should one day we want to increase or decrease the number of judges, we just need to change its value (I will test it in marking your assignment). The class consists of 4 private instance variables: name (a Country object), score (an array, scores given by judges, each value is less than 10 with two decimal places), cf (carried forward derived from the previous round, obviously starting round has no carried forward score, i.e. 0.00) and fs (the final score of the current round). The get SortedList stores the scores in a list (a dummy list) and sort it; you can use it to retrieve the highest, second highest etc. scores. This method is optional, you can find your own way to solve the problem too. The finalScore method returns the sum of the scores given by the judges by eliminating the two highest and the two lowest scores. The get TotalScore method is the sum of carried forward score and the final score. The prinfInfo method displays the information of one country, i.e. a lady representing her country. You can see the printing format later in the following runtime captured screen shots. 3 Let us now explore the main class which drives the whole assignment: -final String Countries -final String Titles YourName_A3 -static void getScore (double score) -static String getCountry(ArrayList alist, double result) -static void displaySortedList(ArrayList alist, String event) -static int getAge() -static void displayGameInfo(ArrayList alist, String event) -static void displayResultInfo(ArrayList alist) -static void update CFArray(ArrayList alist, double[] cfArray) +static void main(String[] args) A few important tasks to be done in the main class: - - - - - - Two String arrays. One array Countries stores the name of countries and one array called Titles stores the titles of the three events (Interview event, swimsuit competition event and evening gown competition event) A method get Score returns an array of judges' scores via the formal parameter. A method get Age generates and returns the age of a participant, reasonable integer. To construct a list of Country objects. You can have an additional method to do this task or just do it in main. A method displays the game info (displayGame Info method) A method displays the result (displayResult method using the print info method defined in the MissWorld class) A method displays the ranking (displaySortedList method) There is a get Country method, I use this method to get the name of the country that has "certain" result. This is an optional method; you can find your own way to solve your problem. You can use an array to store the updated carried forward scores for each country (updateCFArray method), which is an optional method if you have some better ways to process the carried forward scores. Convenient to your design, feel free to amend the suggested methods. Additional / deleting of the proposed methods are allowed Let us look at the runtime analysis: Starting position for event: Interview Country Name Age c/f China Name 1 11 0.00 Thailand Name 2 18 0.00 British Columbia Name 3 19 0.00 South Korea Name 4 14 0.00 Japan Name 5 25 0.00 USA Name 6 22 0.00 Australia Name 7 24 0.00 Venezuela Name 8 20 0.00 Russia Name 9 20 0.00 Brazil Name 10 19 0.00 age 11 is not an adult Countries J 1 32 33 J4 China Thailand British Columbia South Korea Japan USA Australia 2.51 1.80 Venezuela Russia Brazil J5 J6 J7 J8 9.41 9.09 8.16 3.12 5.82 1.28 9.82 9.70 1.71 1.91 9.79 6.19 9.32 6.51 7.68 4.88 6.58 6.82 4.06 3.91 8.24 8.86 3.34 9.24 7.20 2.04 3.52 6.59 3.62 0.26 9.85 8.40 7.18 2.34 8.98 0.23 8.77 3.32 0.61 6.49 2.58 6.80 6.92 4.91 0.35 6.14 9.30 4.75 39 J 10 c/f Current Total 7.55 5.88 6.47 3.99 7.35 1.34 8.56 3.84 1.90 8.75 2.86 8.23 2.24 9.91 8.27 1.01 3.81 9.67 4.26 2.76 4.99 9.31 8.11 4.14 1.99 4.96 3.16 8.75 0.41 3.19 8.52 9.46 5.04 0.41 9.06 7.17 9.43 1.61 5.05 1.67 0.73 1.94 9.52 2.23 6.72 0.00 40.60 40.60 1.10 0.00 24.71 24.71 7.43 0.00 44.79 44.79 5.62 0.00 31.87 31.87 0.00 37.36 37.36 0.00 24.87 24.87 9.97 8.35 0.00 38.35 38.35 0.00 31.18 31.18 0.00 35.01 35.01 0.00 21.64 21.64 The result after the event: Interview 1 British Columbia 44.79 China 40.60 3 Australia 38.35 4 Japan 37.36 15 Russia 35.01 6 South Korea 31.87 Venezuela 31.18 8 USA 24.87 9 Thailand 24.71 10 Brazil 21.64 The first event is an interview event. Firstly, display the country information: the name of country, the name of the contestant, her age, and the carried over scores. Initially the carried forward score for each contestant is 0.00 Next, a summary table to display the information for each country: scores given by judges, the carried forward scores, the total scores for current round and the final scores. At the end of this event, you need to sort the total scores and display the ranking results. Let us now look at the second event: Swimsuit Competition. Starting position for event: Swimsuit Competition Country Name Age c/f China Name 1 11 40.60 Thailand Name 2 18 24.71 British Columbia Name 3 19 44.79 South Korea Name 4 14 31.87 Japan Name 5 25 37.36 USA Name 6 22 24.87 Australia Name 7 24 38.35 Venezuela Name 8 20 31.18 Russia Name 9 20 35.01 Brazil Name 10 19 21.64 Countries China Thailand British Columbia South Korea Japan USA Australia Venezuela Russia Brazil J1 J2 J3 J4 35 J6 37 J8 39 J 10 c/f Current Total 7.20 4.32 6.38 4.61 5.10 4.60 5.85 4.46 2.16 9.90 8.50 1.47 8.31 9.63 5.74 3.34 6.01 9.42 0.50 5.67 4.42 6.67 5.62 7.71 4.82 8.75 2.23 8.14 3.34 4.50 5.55 0.64 0.36 5.49 8.21 5.42 5.70 4.05 6.25 2.72 4.40 4.88 8.42 1.44 2.08 6.33 8.52 9.80 3.67 1.09 5.73 8.34 5.52 2.14 1.51 7.99 1.28 2.86 9.53 5.62 9.03 8.84 2.40 4.09 5.46 0.28 6.47 3.08 6.44 5.92 4.43 7.14 0.50 0.62 6.89 6.46 40.60 31.00 71.60 24.71 37.57 62.28 3.33 44.79 32.58 77.37 31.87 30.71 62.58 4.06 3.50 2.06 37.36 21.64 59.00 1.87 0.93 1.72 1.17 7.69 5.41 4.72 0.33 5.03 5.96 7.85 5.87 9.78 8.31 2.15 24.87 36.72 61.59 1.74 8.17 9.25 38.35 21.76 60.11 2.91 31.18 31.55 62.73 5.39 35.01 29.98 64.99 21.64 34.64 56.28 The result after the event: Swimsuit Competition British Columbia 77.37 2 China 71.60 B Russia 64.99 4 Venezuela 62.73 South Korea 62.58 Thailand 62.28 7 USA 61.59 Australia 60.11 9 Japan 59.00 10 Brazil 56.28 You do some similar tasks to the interview event. You can see that carried forward scores derived from the previous are updated. Final event, the Evening Gown Competition: Starting position for event: Evening Gown Competition Country Name Age c/f China Name 1 11 71.60 Thailand Name 2 18 62.28 British Columbia Name 3 19 77.37 South Korea Name 4 14 62.58 Japan Name 5 25 59.00 USA Name 6 22 61.59 Australia Name 7 24 60.11 Venezuela Name 8 20 62.73 Russia Name 9 20 64.99 Brazil Name 10 19 56.28 6 Countries China Thailand J1 J 2 J3 J4 35 36 37 J8 J 9 J 10 c/f Current Total 9.09 3.10 2.93 2.47 British Columbia South Korea Japan USA Australia Venezuela Russia Brazil 0.76 1.70 6.48 1.66 6.11 3.43 0.68 0.40 6.44 2.85 5.35 7.04 3.95 8.45 7.47 2.18 0.21 8.95 0.58 6.71 1.81 7.06 5.39 0.55 1.13 0.34 1.65 8.12 0.16 0.17 9.95 3.24 9.81 8.10 7.78 0.14 7.46 6.85 7.63 9.55 4.69 0.15 3.87 3.69 4.23 0.26 8.79 1.55 9.37 5.81 7.08 7.85 4.54 1.37 1.64 8.53 5.69 9.83 8.69 4.37 3.28 9.67 6.07 1.29 3.26 9.91 5.84 1.46 2.57 1.87 9.16 2.41 5.72 0.22 4.72 1.73 1.76 71.60 20.72 92.32 62.28 17.09 79.37 77.37 29.18 106.55 62.58 12.30 74.88 59.00 42.51 101.51 61.59 32.53 94.12 3.42 8.70 8.74 7.54 0.38 0.08 2.49 0.06 1.39 60.11 38.42 98.53 62.73 17.98 80.71 4.07 9.24 0.17 1.47 2.89 3.89 4.41 1.73 7.78 3.81 64.99 18.99 83.98 56.28 22.81 79.09 The result after the event: Evening Gown Competition 1 British Columbia 106.55 2 Japan 101.51 B Australia 98.53 USA 94.12 China 92.32 Russia 83.98 Venezuela 80.71 B Thailand 79.37 9 Brazil 79.09 10 South Korea 74.88 Note that convenient to your design, feel free to add in additional methods or amend some of the proposed methods.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Solutions Step 1 Solution Kindly check the below logic step by step package csIT public class Student private String name private int stuNo private String gender private String dobDate of birth Constr... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Programming questions

Question

Compute Paasches index for 2013 using 2000 as the baseperiod.

Answered: 1 week ago

Question

Determine a value index for 2013 using 2000 as the baseperiod.

Answered: 1 week ago