1. Define a class called UFC fighter. a. Make instance variable foe Name, Weight, Wins, Losses b. Create a static variable for TotalFights c. Create a default constructor that defaults name to “NoName yet” and all other variables to 0. d. Create a constructor that has parameters that set the value for name and weight, and sets wins and losses to -. e. Create accessor methods for all the variables. f. Create a method that increments Wins and TotalFights g. Create a method that increments losses and TotalFights. h. Create a method that compares a fighter’s wins to their losses and tells whether or not they have a winning record. 2. Create an Array of integers called Numbers. Allow the user to pick the size of the array and enter values for each index. After the array is filled, return the sum of all the values. Then reprint the numbers and state what percentage of the sum the value is. How many numbers will you enter? 2 1 1 Enter the Numbers 2, Which is 50% of the sum 1, Which is 25% of the sum 1, Which is 25% of the sum Purchase the answer to view it

1. In order to define a class called UFC fighter, we need to specify the instance variables, static variable, constructors, accessor methods, and other necessary methods.

a. The instance variables for UFC fighter are Name, Weight, Wins, and Losses. These variables will represent the name, weight, number of wins, and number of losses for a particular fighter.

b. We also need to create a static variable called TotalFights. This variable will keep track of the total number of fights across all UFC fighters.

c. The default constructor for UFC fighter should set the default values for Name, Weight, Wins, and Losses. In this case, we can set Name to “NoName yet” and all other variables to 0.

d. Additionally, we need to create a constructor that takes parameters to set the values for Name and Weight, and also sets the values for Wins and Losses. Let’s set the default values for Wins and Losses as -1 to indicate that these values are not yet known.

e. To access the instance variables, we need to create accessor methods. These methods should return the values of Name, Weight, Wins, and Losses.

f. Next, we need to create a method that increments both the Wins instance variable and the TotalFights static variable. This method will be called each time a fighter wins a fight.

g. Similarly, we need to create a method that increments the Losses instance variable and the TotalFights static variable. This method will be called each time a fighter loses a fight.

h. Finally, we should create a method that compares a fighter’s wins to their losses and determines whether they have a winning record or not. This method should return a boolean value indicating the result.

2. Moving on to the next task, we need to create an array of integers called Numbers. We should allow the user to specify the size of the array and input values for each index.

After the array is filled, we should calculate and return the sum of all the values. Then, we can proceed to reprint the numbers and state what percentage of the sum each value represents.

To accomplish this, we can prompt the user to enter the number of numbers they want to enter. Then, we can use a loop to input the values for each index of the array.

Once the array is filled, we can calculate the sum of all the values by iterating through the array and adding each element to a variable.

After obtaining the sum, we can iterate through the array again and calculate the percentage of the sum each value represents by dividing each element by the sum and multiplying by 100.

Finally, we can print out the numbers along with their respective percentages.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer