程序代写代做 Java Hive C Due: 1/28

Due: 1/28
Homework: 30% Project: 10% Midterm: 25% Final: 35%
The letter grade is determined as follows:
90 ≤ average < 94: A- 80 ≤ average < 83: B- 70 ≤ average < 73: C- 60 ≤ average < 70: D The signature of the method is: 94 ≤ average: A, 83 ≤ average < 87: B 73 ≤ average < 77: C 87 ≤ average < 90: B+ 77 ≤ average < 80: C+ CS526 Homework Assignment 1 This assignment is a practice of using basic Java features, including loops, selection statements, and arrays. Part 1. Create a file named Hw1_part1.java, which has the following two methods. The first method receives the grades of all grading components of a student and calculates the weighted average, determines the letter grade of the student, and prints on the screen the weighted average and the letter grade. The grading components and their weights are: public static void grade(int homework, int project, int midterm, int finalExam) The second method is the main method, which is used to test the grade method. The following shows two examples: If you run your program with: public static void main(String[] args) { grade(100, 90, 85, 95); } Your output should be: Average is 94.0, Grade is A If you run your program with: public static void main(String[] args) { grade(100, 100, 90, 75); } Your output should be: Average is 88.75, Grade is B+ Part 2. Create a file named Hw1_part2.java, which has the following two methods. The first method receives an array of integers, which are sorted in non-decreasing order, and calculates the mean, median, and the mode of these numbers and prints them on the screen. We assume that the integers in the array are between 0 and 9, inclusively. The median of a set of numbers is determined in the following way:  If the number of integers is odd, the “middle” number is the median.  If the number of integers is even, the average of two middle numbers is the median.  Example: The array has [2, 5, 5, 5, 7, 8, 8]. Median = 5 The array has [2, 2, 4, 4, 4, 7, 8, 8, 8, 8]. Median = (4 + 7) / 2 = 5.5 The mode of a set of numbers is a number that occurs most frequently. The following shows examples:  Thearrayhas[2,5,5,5,7,8,8].Mode=5  Thearrayhas[2,2,4,4,4,7,8,8,8,8].Mode=8 The signature of this method should be: public static void stats(int[ ] numbers) The second method is a main method. If you run this program with the following main method: public static void main(String[] args) { int[] a = {2, 5, 5, 5, 7, 8, 8}; int[] b = {2, 2, 4, 4, 4, 7, 8, 8, 8, 8}; stats(a); stats(b); } Your output should be: Mean = 5.714 Median = 5.0 Mode = 5 Mean = 5.5 Median = 5.5 Mode = 8 We assume that there is only one mode in a given array of integers. Documentation No separate documentation is needed. However, you must include sufficient inline comments within your program. Deliverables You must submit Hw1_part1.java, Hw1Part2.java files. Combine the two files (and other additional files, if any) into a single archive file, name it LastName_FirstName_hw1.EXT, where EXT is an appropriate file extension, such as zip of rar, and upload it to Blackboard. Grading Each Part is worth 10 points. So, total possible points are 20 points. Part 1: Your program will be tested with two inputs (two sets of grading components) and up to 3 points will be deducted for each wrong output. Part 2: Your program will be tested with two inputs (two arrays) and up to 3 points will be deducted for each wrong output. Up to 4 points will be deducted if your program does not have sufficient inline comments.