Skip to content

Commit 63c1d20

Browse files
committed
change scanner in to scanner input
1 parent e545658 commit 63c1d20

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/org/launchcode/java/demos/collections/ArrayGradebook.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void main(String[] args) {
1111

1212
String[] students = new String[maxStudents];
1313
double[] grades = new double[maxStudents];
14-
Scanner in = new Scanner(System.in);
14+
Scanner input = new Scanner(System.in);
1515

1616
String newStudent;
1717
int numStudents = 0;
@@ -20,7 +20,7 @@ public static void main(String[] args) {
2020

2121
// Get student names
2222
do {
23-
newStudent = in.nextLine();
23+
newStudent = input.nextLine();
2424

2525
if (!newStudent.equals("")) {
2626
students[numStudents] = newStudent;
@@ -32,7 +32,7 @@ public static void main(String[] args) {
3232
// Get student grades
3333
for (int i = 0; i < numStudents; i++) {
3434
System.out.print("Grade for " + students[i] + ": ");
35-
double grade = in.nextDouble();
35+
double grade = input.nextDouble();
3636
grades[i] = grade;
3737
}
3838

src/org/launchcode/java/demos/collections/ArrayListGradebook.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ public static void main(String[] args) {
99

1010
ArrayList<String> students = new ArrayList<>();
1111
ArrayList<Double> grades = new ArrayList<>();
12-
Scanner in = new Scanner(System.in);
12+
Scanner input = new Scanner(System.in);
1313
String newStudent;
1414

1515
System.out.println("Enter your students (or ENTER to finish):");
1616

1717
// Get student names
1818
do {
19-
newStudent = in.nextLine();
19+
newStudent = input.nextLine();
2020

2121
if (!newStudent.equals("")) {
2222
students.add(newStudent);
@@ -27,7 +27,7 @@ public static void main(String[] args) {
2727
// Get student grades
2828
for (String student : students) {
2929
System.out.print("Grade for " + student + ": ");
30-
Double grade = in.nextDouble();
30+
Double grade = input.nextDouble();
3131
grades.add(grade);
3232
}
3333

src/org/launchcode/java/demos/collections/HashMapGradebook.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class HashMapGradebook {
99
public static void main(String[] args) {
1010

1111
HashMap<String, Double> students = new HashMap<>();
12-
Scanner in = new Scanner(System.in);
12+
Scanner input = new Scanner(System.in);
1313
String newStudent;
1414

1515
System.out.println("Enter your students (or ENTER to finish):");
@@ -18,15 +18,15 @@ public static void main(String[] args) {
1818
do {
1919

2020
System.out.print("Student: ");
21-
newStudent = in.nextLine();
21+
newStudent = input.nextLine();
2222

2323
if (!newStudent.equals("")) {
2424
System.out.print("Grade: ");
25-
Double newGrade = in.nextDouble();
25+
Double newGrade = input.nextDouble();
2626
students.put(newStudent, newGrade);
2727

2828
// Read in the newline before looping back
29-
in.nextLine();
29+
input.nextLine();
3030
}
3131

3232
} while(!newStudent.equals(""));

0 commit comments

Comments
 (0)