Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble using this provided format to find the highest/lowest/average values of certain rows in a two dimensional array turned into a one

I am having trouble using this provided format to find the highest/lowest/average values of certain rows in a two dimensional array turned into a one dimensional array and putting the values in the same row order into a different array. The provided code is extremely confusing yet it is required to be followed.

Code snippet because apparently I am not allowed to post code on this website so I don't know if this will even go through.

This is part of the code where a txt file of an array is loaded in with stringtokenizer, which turns the txt data into a single dimensional array.

Here is a copy of actual data to be used for input.

Stud Qu1 Qu2 Qu3 Qu4 Qu5

1234 052 007 100 078 034

2134 090 036 090 077 030

3124 100 045 020 090 070

4532 011 017 081 032 077

5678 020 012 045 078 034

6134 034 080 055 078 045

7874 060 100 056 078 078

8026 070 010 066 078 056

9893 034 009 077 078 020

1947 045 040 088 078 055

2877 055 050 099 078 080

3189 022 070 100 078 077

4602 089 050 091 078 060

5405 011 011 000 078 010

6999 000 098 089 078 020

Essential requirements:

  • Read Student data from a text file.
  • Compute High, Low and Average for each quiz.
  • Print the Student data and display statistical information like High/Low/Average..

public cass Statistics {

//all the variables necessary

private int [] lowscores = new int [5];

private int [] highscores = new int [5];

private float [] avgscores = new float [5];

public void findlow(Student [] a) {

/* This method will find the lowest score (for quiz 1) and store it in anarray names lowscores. */

//nested for loop

int i,j;

for each quiz

for (j; j<5; j++){

if (lowscores[i] < a.Student(j).getScores(i));

(lowscores[i] = a.getStudent(j).getScores(i));

//get score value nad put it into lowscores?

}

public void findhigh(Student [] a) {

/* This method will find the highest score and store it in anarray names highscores. */

}

public void findavg(Student [] a) {

/* This method will find avg score for each quiz and store it in an array names avgscores. */

}

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

Students also viewed these Programming questions