Math

QuestionThe following program is to read College name, a number of students and tuition from the file "colleges.txt" and print the College name, the number of students and tuition. Select the correct option to replace the missing code. public class ScannerStuff \{ public static void main(String[] args) \{ try \{ Scanner input == new Scanner\operatorname{Scanner} (new File("colleges .txt")); while (input hasNext()) \{ String name =/=/^{*} missing code A/\mathrm{A}^{*} /; int numstu =/=/ * missing code B/\mathrm{B}^{*} /; int tuition = input. nextInt(); input. nextLine();
System. out. println(name +n++\cdots n+ numStu +++\cdots+ tuition); }\} ) catch(IOException e) ( System.out.println(); \} ) )
Option 1: A: input. next() B: input. next()
Option 2: A: input. nextint() B : input. nextInt()
Option 3: A: input. nextline() B: input. nextint()

Studdy Solution
The correct option to replace the missing code is **Option 3**: - A: `input.nextLine()` - B: `input.nextInt()`

View Full Solution - Free
Was this helpful?

Studdy solves anything!

banner

Start learning now

Download Studdy AI Tutor now. Learn with ease and get all help you need to be successful at school.

ParentsInfluencer programContactPolicyTerms
TwitterInstagramFacebookTikTokDiscord