# Thread: help w/ storing/scanning numbers in arrays

1. Member
Join Date
Oct 2010
Posts
44
Rep Power
0

## help w/ storing/scanning numbers in arrays

im kinda stuck on what to do on this assignment and tried to email my instructor but he didnt respond(were on spring break btw)

but here are my instructions

Enhance / modify the program you created in the previous assignment. Create a class ScanArray. This class should have two methods FindMax and FindMin. Class ScanArray should have a constructor. main should call the constructor, next should use / call the two methods of the object to identify the min and max. Next, main informs the instructor of the minimum grade and maximum grade.

and here is my code from the previous assignment
Java Code:
```import java.util.Scanner;
import java.util.Arrays;

public class Array
{ public static void main(String[] args)
{
//input scanner
Scanner input = new Scanner(System.in);

double[]midTerm1= new double [10];
for (int A = 0; A <midTerm1.length; A++){
midTerm1[A] = input.nextDouble();
}
System.out.println("Now");

double[]midTerm2=new double[10];
for(int B=0; B<midTerm2.length;B++){
midTerm2[B] = input.nextDouble();
}
System.out.println("Now");

//Prompt User for Final Exam grades
double[]finalExam = new double[10];
for(int C = 0; C<finalExam.length; C++){
finalExam[C] = input.nextDouble();
}
double [] grades = new double [10];

for (int i = 0; i < grades.length;i ++){
}

double max = 0;
double min = 0;

for (int i=1; i<grades.length; i++) {
}
}

for (int i=1; i<grades.length; i++) {
}
}

System.out.print("Your highest test score is: " + max);
System.out.print("Your lowest test score is: " + min);
System.out.print("You have entered following grades for midTerm1: ");
System.out.println(Arrays.toString(mid…
System.out.print("You have entered following grades for midTerm2: ");
System.out.println(Arrays.toString(mid…
System.out.print("You have entered following grades for Final Exam: ");
System.out.println(Arrays.toString(fin…

}
}```

2. Did you have a specific question? We're not here to do your homework for you.

3. Member
Join Date
Mar 2011
Posts
48
Rep Power
0
Ok, I wont solve the problem for you.

1. This class should have two methods FindMax and FindMin.
2. Class ScanArray should have a constructor. main should call the constructor, next should use / call the two methods of the object to identify the min and max.
3. Next, main informs the instructor of the minimum grade and maximum grade.

So...I'll help a little but wont cover everything here.
1. Create a class called ScanArray
2. Create a method called findMax
3. Create a method called findMin
**Now think about if these methods need to pass any parameters or not, if not, why not, and if so, why.
**Also think about how to loop through an array and find the smallest number.
**Also think about how to loop through an array to find the largest number.

From your previous assignment, it looks like you pretty much have some of this already covered, but you need to figure out which parts and how to write them in the new class and how to use them.

I dunno if this is useful, but I find it easier to break down the specification document (what the instructor wants you to do) into basic steps. Just remember verbs in the specification would make great methods, and nouns would make great fields in a class.

Good Luck

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•