Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A. Consider the structure of a class roster for a university course. It contains

ID: 666970 • Letter: A

Question

A. Consider the structure of a class roster for a university course. It contains a row for each student enrolled in the course. What might the array used to produce this report look like? Discuss the elements that would be needed in this structure. Create an array that would solve this programming problem.

B. At what point should you consider changing from individual variables to an array?

C. Is it reasonable to use an array when you only have two or three items to track? Why or why not?

D. Consider the number of sets of those two or three items when making your decision.

Explanation / Answer

A) For this type of data we have to use two dimensional array...where first index
we store student id and in another index we store student course...
Elements required are:
String id; // to store the id of the student
String course_name; //to store course of that particular stuent.

Here is sample java program to achieve this:
----------------------------------------------
public class roster{
        String student_details[10][10];
        student_details[0][0] = "John";
        student_details[0][1] = "Computers"; //in this way we will fill data into array
}

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

B) At what point should you consider changing from individual variables to an array?
   When we store multiple student of same type then we use arrays..since to reduct
   cost incurred by using so many varaibles.

----------------------------------------------------------------------------
C) Is it reasonable to use an array when you only have two or three items to track? Why or why not?
Yes it is reasonable to use arrays...
Let us calculate cost incurred using arrays and varaibles...
If we want to store three student details..then we have ti use six variables
then it take 6 x 4 = 24 bytes...
array is of 8 bytes...( since double) and to store s studen details it wii take 12 bytes
total 20...
so difference is four....this count will increase numbert of records. In arrays we
will have full flexibility.

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

D. Consider the number of sets of those two or three items when making your decision.
here number of sets means...if we store student details less than three then we will go with
variables other wise we will go with arrays.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote