Task 6: Arrays

6.1: Make an array of n elements and initialize it from user input. Get n from user input. Print all the numbers, find minimum number and its index in array, find maximum number and its index in the array, find the average of all numbers.

6.2: Roll a 6 faces dice 1 million times, print how many times each face appear along with its percentage? Use arrays to store each face count e.g. face[3] shall store how many times 4 appeared during random rolls. See figure 7.7 of book for detail.

6.3: Make a program that shuffle cards. Print the deck before shuffling and after shuffling. See Figure 7.9, 7.10 and 7.11 from reference book.

6.4. Extend the Task 5 such that a Student may have more than one address. That means, you must define an attribute in Student class that is an array of Address class. In main method, create an array of Student that represent all students in a classroom. Let user input the number of students, user attributes (id and name are enough). Let user also enter the number of addresses user need to store in each student object. Also fields of address from user input too.

6.5. Make a GradeBook class with courseName and grades fields. Where courseName is a String and grades is 2-dimensional int array. Each row represent one student and each of that row contains marks in different tests of that particulat student. Below array is just an example, it contains marks of 2 students, 1st student given 2 tests, 2nd given 3 tests.

int[][] marks = {
   {70, 95, 80}

Get number of students from user input. Number of tests for each student may be different, so your program shall take number of tests from user input too, of each student. After fully initializing the GradeBook object, print following statistics:
  1. Which student given maximum tests, print just index. Assume, index represent student id
  2. Who got maximum average marks
  3. Average marks of the class
  4. Average marks of each student in class
  5. Minimum marks of each student 
  6. Maximum marks of each student 
  7. Average, minimum and maximum marks of the student, when student ID is given in CLI
Write different methods in GradeBook class to perform each function listed above. Call that method from main after initializing the GradeBook object with required data.

6.6. From domain model described below, identify entities and create object oriented model using composition and arrays etc.

CS department runs two programs BSCS and BSSE but in future, it may start more programs. Each program has multple batches. A batch is represented by year and intake i.e. Fall and Spring (fixed constants). Each batch of all programs has a list of courses (called, Schme of Studies or SoS for short) and students of that batch are required to pass all courses from SoS to get the degree clearance. In each program, department enrolls multiple students. Those students are divided into multiple sections. There may be different number of students in each section. In addition to students, each section has also a name and a CR who is a student of the same class. Each student can register one or more courses from the scheme of studies, where each course has code, title and credit hours.

Write a test class to demonstrate your domain model, no need to get data from user, you can hard code values. Use default constructor to create objects, initialize data using set methods or directly. Also define some behavior to verify that all students of each program has registered courses defined in their SoS only. System should show error, if a student has registered a course that do not exist in his/her SoS (you can make an example SoS by your own).



Update the GradeBook class of 6.5 as bellow and perform the same set of operations:

public class GradeBook {
    private String courseName;
    private Student[] students;
// ... other methods .... 

public class Student{
    private String name;
    private int id;
    int marks[][]; // each row represent different subjects and each column  
                   // represent marks in different test of that subject 

With other operations, also print the student name and id who registered maximum subjects. student name and id who got maximum average and who got minimum average marks.