首页 > > 详细

CS526 O2编程讲解、Java程序设计辅导、辅导program语言程序解析SPSS|讲解Python程序

CS526 O2 – Fall 2020
Homework Assignment 1
This assignment is practice of Java basics.
Problem 1 (50 points). An incomplete Java program named Hw1_P1_incomplete.java is posted
on the course website. You must complete the program by implementing the following
requirements. Don’t forget to delete “_incomplete” from the file name.
This program has three methods. The first method receives an array of integers and calculates the
average, the minimum, and the maximum of the integers and prints them on the screen.
The signature of this method is:
public static void stats(int[ ] numbers)
The second method creates and prints a subarray of a given array. The specification of the method
is:
 Signature of method:
public static void subarray(int[ ] a, int from, int to)
 Input arguments:
a: An array of integers
from: The index of an element in a which becomes the first element in the subarray
to: The index of an element in a which becomes the last element in the subarray
 Behavior:
 A new integer array is created, which is a subarray of a, and it includes elements
a[from] to a[to], inclusively.
 Prints the subarray.
 There is no return value.
The third method is a main method. If you run this program with the following main method:
public static void main(String[] args) {
int[] a = {15, 25, 10, 65, 30, 55, 65};
    System.out.print("\nGiven array is: ");
    for (int i=0; i

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!