Question

In: Computer Science

Problem Statement – Gymnastics Contest Java The Adelaidean Gymnastics Federation is an organisation devoted to running...

Problem Statement – Gymnastics Contest Java

The Adelaidean Gymnastics Federation is an organisation devoted to running the best Gymnastics contests in all of Adelaide.

In 2031, the School of Computer Science from the University of Adelaide was chosen to develop the Gymnastic Contest software. The competition has few criteria. The winner of the competition must demonstrate skills of good balance. Competitors must have the ability to jump high. A contestant should demonstrate coordination, strength and exhibit aesthetics during their routine. In this final project we require you to design all the features and functionalities for this event to happen.

We are focused on the final for this contest, when each finalist will be judged by the five skills aforementioned in a scale from 0.0 to 10.0. Besides, this the system also has to store competitors name, age and suburb and each finalist contains a moto, like “ I can bounce higher than anyone else!”

Requirements:

Design and develop the classes Contestant, Finalist and Contest.

● [30 % marks] Contestant: consist of a competitor;

● [30% marks] Finalist: consist of a Contestant Competitor that got into the finals in the gymnastics competition.

● [40 % marks] Contest : basic functionalities to guarantee that the contest will

happen; Specifications for the class Contestant:

Design and develop the classes Contestant, Finalist and Contest.

The class Contestant is a general class that represent any sort of competitor;

Requirements:

1. Implement the accessors and mutators;

2. Implement the parameters constructors;

a. Name, suburb, age;

b. Name, suburb, age and the skils: balance, jump, coordination, strength, aesthetics;

3. Implement function getMean(): this method aims to return the mean score of all skills from a Contestant;

Constraints:

1. Comment this code to acquire code style marks;

2. This problem represents 30% of your marks

a. Full marks: use abstraction, implement 1,2,3;

b. Half marks: implement at least 1,2;

c. No marks: doesn’t compile;

Specifications for the class Finalist:

/* * * * * * * *

class Finalist

This class inherit properties from the class Contestant.

This class aims to represent the Finalist of gymnastics contest for 2031

Requirements:

1. Implement the accessors and mutators;

a. moto;

2. Implement method display which displays each field of this contestant on a separate line with the name of the field then a “:” and then the value of the fields;

Constraints:

1. This problem represents 30% of your marks

a. Full marks: use inheritance, implement 1,2;

b. Half marks: implement at least 1,2;

c. No marks: doesn’t compile;

2. Observe that the property moto belongs to Finalist;

class Contest

This class depends on the data structure FinalistList containing items of the class Finalist.

This class aims to represent the Gymnastics Contest Final for the year 2031.

Requirements:

For the class Contest:

1. Implement method addFinalist;

2. Implement a method sortFinalist; that sorts by the mean of skills.

3. Implement the method printFinalists;

Constraints:

1. There are no restrictions regarding what resources use in order to implement this problem; it means that you can use either array, list, linked lists, etc...

2. There is a MAX NUMBER of 5 Finalists;

3. This problem represents 40% of your marks

a. Full marks: use linked list, and implement 1,2,3

b. Half marks: use array implement at least 2 out of 3;

c. No marks: doesn’t compile;

Details

addFinalist will take a Finalist as a parameter and add the finalist to the list if the number of finalist is beyond MAX_NUMBER an IndexOutOfBoundsException should be thrown.

sortFinalist will sort the FinalistList structure by the mean of the skills of the Finalists.

printFinalist will print the members of FinalistLists by calling display on each of the Finalist in

that list in the order they appear in that list.

Solutions

Expert Solution

Here is the answer for your question in Java Programming Language.

Kindly upvote if you find the answer helpful.

NOTE : For the skills attribute I have taken it as a double array just to store scores of the skills. If you want to store name and scores as well you can declare it as a class and use its array of objects. Please comment below if you need any guidance to create skills class.

########################################################################

CODE :

contestant.java

public class Contestant {
//Class private variables
private String name;
private String suburb;
private int age;
private double[] skills;

//Accessors

public String getName() { return name; }
public String getSuburb() { return suburb; }
public int getAge() { return age; }
public double[] getSkills() { return skills; }
  
//Mutators

public void setName(String name) { this.name = name; }
public void setSuburb(String suburb) { this.suburb = suburb; }
public void setAge(int age) { this.age = age; }
public void setSkills(double[] skills) { this.skills = skills; }
  
//Parameterised constructor(a)
public Contestant(String name, String suburb, int age) {
this.name = name;
this.suburb = suburb;
this.age = age;
}
//Parameterised constructor(b)
public Contestant(String name, String suburb, int age, double[] skills) {
this.name = name;
this.suburb = suburb;
this.age = age;
this.skills = skills;
}
//Implementation of getMean() function
public double getMean(){
return ((skills[0] + skills[1] + skills[2] + skills[3] + skills[4])/5);
}
}

###########################################################

Finalist.java

import java.text.DecimalFormat;
public class Finalist extends Contestant{
private String motto;

public Finalist(String name, String suburb, int age,String motto) {
super(name, suburb, age);
this.motto = motto;
}
public Finalist(String name, String suburb, int age, double[] skills,String motto) {
super(name, suburb, age, skills);
this.motto = motto;
}   
//Accessor
public String getMotto() { return motto; }
//Mutator   
public void setMotto(String motto) { this.motto = motto; }
  
public void display(){
System.out.println("Name : " + getName());
System.out.println("Suburb : " + getSuburb());
System.out.println("Age : " + getAge());
System.out.println("Motto : " + motto);
System.out.println("Skills : ");
System.out.println("--------------------------------");
double[] skills = getSkills();
System.out.println("Balance : " + skills[0]);
System.out.println("Jump : " + skills[1]);
System.out.println("Coordination : " + skills[2]);
System.out.println("Strength : " + skills[3]);
System.out.println("Aesthetics : " + skills[4]);
System.out.println("--------------------------------");
System.out.println("Mean of skills : " + new DecimalFormat("#.00").format(getMean()));
}
}

####################################################################

contest.java


import java.util.LinkedList;
import java.lang.IndexOutOfBoundsException;

public class Contest {
//Class private member variables
private final int MAX_NUMBER = 5;
private LinkedList<Finalist> finalists;

//default Constructor
public Contest() {
this.finalists = new LinkedList<>();
}
  
//Implementation of addFinalist methods
public void addFinalist(Finalist finalist){
finalists.add(finalist);
if(finalists.size() > MAX_NUMBER)
throw new IndexOutOfBoundsException();
}
public void sortFinalist(){   
Finalist obj;
for(int i = 0;i<finalists.size();i++){
for(int j = 0;j<finalists.size();j++){
if(finalists.get(i).getMean() > finalists.get(j).getMean()){
obj = finalists.get(i);
finalists.set(i,finalists.get(j));
finalists.set(j,obj);
}
}
}
}
  
public void printFinalists(){
for(int i = 0;i<finalists.size();i++){
System.out.println("======================================");
finalists.get(i).display();
System.out.println("======================================");
}
}
}

##################################################################

ContestDriver.java

public class ContestDriver {
public static void main(String[] args){
Contest finalContest = new Contest();
try{
double[] skills1 = {5.5,4.3,6.5,3.4,7};
finalContest.addFinalist(new Finalist("John Doe","Suburb1",30,skills1,"I can bounce higher than anyone else"));
double[] skills2 = {6.4,3.3,9.8,3.4,7};
finalContest.addFinalist(new Finalist("James Williams","Suburb2",25,skills2,"I am the strongest man"));
double[] skills3 = {5.5,3.3,10.0,3.4,7};
finalContest.addFinalist(new Finalist("Albert Thomas","Suburb3",38,skills3,"Coordination leads to success"));
double[] skills4 = {5.9,3.3,7.4,8.0,6.8};
finalContest.addFinalist(new Finalist("Louis Philip","Suburb4",32,skills4,"I can balance anything with ease"));
double[] skills5 = {3.3,3.1,10.00,4.9,5.9};   
finalContest.addFinalist(new Finalist("Lina Roy","Suburb5",34,skills5,"I can jump higher that anyone else"));
  
System.out.println("Before sorting : ");
finalContest.printFinalists();
finalContest.sortFinalist();
System.out.println("After sorting : ");
finalContest.printFinalists();
  
}catch(IndexOutOfBoundsException e){
System.out.println("ERROR : Max of 5 Finalists allowed");
}
}
}

#############################################################

Contestant.java

#######################################################################

Finalist.java

#####################################################################

contest.java

######################################################################

ContestDriver.java

###################################################################

OUTPUT :

Any doubts regarding this can be explained with pleasure :)


Related Solutions

Problem 3: (a) Implement a sublinear running time complexity recursive function in Java public static long...
Problem 3: (a) Implement a sublinear running time complexity recursive function in Java public static long exponentiation(long x, int n) to calculate x^n. Note: In your function you can use only the basic arithmetic operators (+, -, *, %, and /). (b) What is the running time complexity of your function? Justify. (c) Give a number of multiplications used by your function to calculate x^63. Important Notes: • For the item (a): o You must add the main method in...
NEED IN JAVA Problem statement. This application will support the operations of a technical library for...
NEED IN JAVA Problem statement. This application will support the operations of a technical library for an R&D organization. This includes the searching for and lending of technical library materials, including books, videos, and technical journals. Users will enter their company ids in order to use the system; and they will enter material ID numbers when checking out and returning items.   Each borrower can be lent up to five items. Each type of library item can be lent for a...
Java Complete Example.java to fulfill the following problem statement: Write a program to accept a list...
Java Complete Example.java to fulfill the following problem statement: Write a program to accept a list of numbers, one per line. Input is provided from a file if one is provided as the first command line argument. If a file is not provided, input should be read from the terminal. The numbers can either be whole numbers or floating point numbers. The program should continue to accept input until a number equal to 00 is input. Of course, if the...
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program...
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program that will print the number of words, characters, and letters read as input. It is guaranteed that each input will consist of at least one line, and the program should stop reading input when either the end of the file is reached or a blank line of input is provided. Words are assumed to be any non-empty blocks of text separated by spaces, and...
JAVA for Dummies HELP Problem Statement: Jeff Bezos has decided to have a party at his...
JAVA for Dummies HELP Problem Statement: Jeff Bezos has decided to have a party at his mansion, and he’s invited 50 couples. As the couples arrive at the mansion, they receive a ticket with a number (like at the deli counter), with the first couple receiving the tickets labeled 1 and 2, the second couple getting 3 and 4, and so on. Jeff has noticed in the past that when he throws parties, conversation groups most often occur in groups...
We have a list of runner and their running time, write a program in Java to...
We have a list of runner and their running time, write a program in Java to show the fastest runner and their time.
Problem: Acme Super Store is having a contest to give away shopping sprees to lucky families....
Problem: Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera and one...
Python Knapsack Problem: Acme Super Store is having a contest to give away shopping sprees to...
Python Knapsack Problem: Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera...
This for Java Programming Write a java statement to import the java utilities. Create a Scanner...
This for Java Programming Write a java statement to import the java utilities. Create a Scanner object to read input. int Age;     Write a java statement to read the Age input value 4 . Redo 1 to 3 using JOptionPane
Define a java problem with user input, user output, Do While Statement and some mathematical computation....
Define a java problem with user input, user output, Do While Statement and some mathematical computation. Write the pseudocode, code and display output.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT