Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2) Write a program in java that prints the maximum and minimum of an integer array of arbitrary size. The program should use a call

2) Write a program in java that prints the maximum and minimum of an integer array of arbitrary size. The program should use a call to a method which prints this to console and uses iteration (i.e., a for or while loop).

e.g. void printMaxMin(int array[]).

Demonstrate that your program works by printing to the console a sample array and the final result. Call the primary source file ArrayMaxMinPrinter.java

3) Write a program in java that copies elements from one source integer array of arbitrary size to another target array with twice the size. Use a method call that takes the two integer arrays as arguments.

e.g., void copyArrays(int source[], int target[]).

Demonstrate that your program works by printing to the console a sample source array and the final target array. Call the primary source file CopyArrays.java

4) In this problem we will create a user defined Java ArrayList holding student objects from the CUS 1126 class. Make sure you Import the ArrayList class into your source file i.e., import java.util.ArrayList.

The class for students in CUS 1126 is defined as

class Students{

String fname; //first name of student

String lname; //last name of student

int lab1_score; //score in first lab

}

Read up java documentation and online resources on how to insert elements in an Arraylist. Create an ArrayList with five student objects based on the class above. Print out all the member variables of each the individual students after the list has been created. Make sure you use intuitive console messages to make this clear. Call the primary source file StudentArrayList.java

5) In the same program as in 4, create a method that prints out the average of lab1 scores given an array list of students of arbitrary size as an input argument. Demonstrate this works for your five member student array list created in 4.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lectures On Public Economics

Authors: Anthony B. Atkinson, Joseph E. Stiglitz

1st Edition

0691166412, 978-0691166414

Students also viewed these Databases questions