// Name: // Section: public class Lab9 { public static void main(String[] args)
ID: 3632124 • Letter: #
Question
// Name:// Section:
public class Lab9
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int numInts = 0;
int value = 0;
// Declare SIZE_ARR, a final int equal to 10.
// [Add Code Here]
// Declare an int array named iArr with its
// size equal to SIZE_ARR:
// [Add Code Here]
// Write a loop that will loop through until no more
// input is available.
// [Add Code Here]
// Use defensive programming to read in a number
// [Add Code Here]
// Verify that there is enough room to add
// the number read in into the array iArr.
// If not enough room display an error message
// and quit the program.
// [Add Code Here]
// Put the number read in into the array iArr
// [Add Code Here]
// Increment your num ints counter
// [Add Code Here]
// End of file loop
// [Add Code Here]
// Write a second loop that will print out the contents
// of the array as shown in the sample output.
// [Add Code Here]
} // end of main method
} // end of Lab9
It's supposed to read in the .in file. How do I do this!
Explanation / Answer
Hope this helps, please rate LifeSaver! import java.util.Scanner; public class Lab09 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int numInts = 0; int value = 0; // Declare SIZE_ARR, a final int equal to 10. final int SIZE_ARR = 10; // Declare an int array named iArr with its // size equal to SIZE_ARR: int[]iArr = new int[SIZE_ARR]; // Write a loop that will loop through until no more // input is available. for(int i =0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.