1. Engineering
  2. Computer Science
  3. computer science java please include all code for my...

Question: computer science java please include all code for my...

Question details

Computer Science - Java

Please include all code for my reference. This is my set up. Please include comments for easier understanding. Paste the whole code as plain text as the answer please.

/*
/*
* Name:
* Period:
*
* Assignment 7 - Statistics
*
*
*/

import java.util.Scanner;
import java.util.ArrayList;

class Assignment7 {

public static void createArrayList(ArrayList<Integer> nums)
{
}

public static void sortArrayList(ArrayList<Integer> nums)
{
}
  
public static int calculateRange(ArrayList<Integer> nums)
{
}
  
public static double calculateMean(ArrayList<Integer> nums)
{
}

public static double calculateMedian(ArrayList<Integer> nums)
{
}
  
public static int calculateMode(ArrayList<Integer> nums)
{
}

public static void main(String[] args)
{
ArrayList <Integer> nums = new ArrayList<Integer>();
createArrayList(nums);
System.out.println("The original list is: " + nums);
sortArrayList(nums);
System.out.println("The sorted list is: " + nums);

System.out.println("Range: " + calculateRange(nums));
  
System.out.println("Mean: " + calculateMean(nums));

System.out.println("Median: " + calculateMedian(nums));
  
int m = calculateMode(nums);
if (m==-1)
System.out.println("There is no mode");
else
System.out.println("The mode is " + nums.get(m));
  
}
}

-----------------------------------------------------------------------------------------

Screenshot of the rubric:

AP Computer Science Coding Assignment 7- Statistics Name Due Date: Sunday January 27 (3rd Q grade) This program calculates statistical attributes of a user entered list of numbers. The any size list and the list may have an even or odd number of values. program should handle After the ArrayList is created, sort the numbers in the ArrayList. Print the ArrayList to the screen after it is full and sorted. Once the list is sorted, your program should generate the mean, mode, median, range of the numbers in the list. These computations must be done in the methods provided in the template Use the formulas below to calculate. Mode is the most challenging to get correct. Make sure you test arrays that have NO mode, have 2 numbers repeated same number of times, more than one number repeated but one more than others, and first or last number in list as mode. Methods you need to code in template: public static void createArrayList(ArrayList<Integer> nums) ask the user to input a list of numbers. It should work for any amount of numbers and let them stop inputting by your choice of methods (for example, you can have them enter stop or-1 or whatever). As they enter the numbers, you should add them to the ArrayList nums. public static void sortArrayList(ArrayList<integer> nums)-sort the numbers in the passed in ArrayList. You may use any sort algorithm you would like public static int calculateRange(ArrayList<integer> nums)-calculates the range of the numbers in the ArrayList Range Highest value- Lowest value public static double calculateMean(ArrayList<Integer> nums) calculates and sends back the mean of the numbers in the ArrayList nums. Mean (average) (sum of numbers in list)/(how many numbers in list) public static double calculateMedian(ArrayList<integer> nums)- Median: To find the Median, place the numbers in value order and find the middle. If there are an even number of elements, average the 2 numbers in the middle public static int calculateMode(ArrayList<integer> nums) To find the mode, or modal value, first put the numbers in order, then count how many of each number. A number that appears most often is the mode. For the purposes of this program, if no number appears more than any other number, there is no mode and that is what you should output. Do this by sending back -1 when this happens. Grading considerations, 50 out of 50 points: Code is commented in header and above methods: 10 points Array created correctly: 5 points Array sorted correctly: 10 points Range correct: 5 points Mean correct: 5 points Mode correct: 10 points Median correct: 5 pointsAP Computer Science Coding Assignment 7- Statistics Name Due Date: Sunday January 27 (3rd Q grade) Sample Run 1 Enter your list of numbers, -1 to stop The original list is [7, 6, 5] The sorted list is [5, 6, 7] Range: 2 Mean: 6.0 Median: 6.0 There is no mode Sample Run 2: Enter your list of numbers, -1 to stop The original list is [7, 7, 6, 5] The sorted list is: [5, 6, 7, 7] Range: 2 Mean: 6.25 Median: 6.5 The mode is 7 Sample Run 3 Enter your list of numbers, -l to stop The original list is: [3, 4, 6, 7, 5, 5, 61 The sorted list is: [3, 4, 5, 5, 6, 6, 7] Range: 4 Mean: 5.142857142857143 Median: 5.0 There is no mode

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution