Question: Write the inputLicenses ( ) method in the Database class. Within inputLicenses ( ) , use scnr to read each line number until - 9

Write the inputLicenses() method in the Database class. Within inputLicenses(), use scnr to read each line number until -999 is read from input. If the line number is not equal to -999:
Create a new License object.
Use the License object's readGroupAndState() method to read the license's group and state from input.
Append the License object to ArrayList licenseList.
Ex: If the input is:
1 A NY
2 D RI
3 B CT
4 C AL
-999
then the output is:
License group: A, State: NY
License group: D, State: RI
License group: B, State: CT
License group: C, State: ALimport java.util.Scanner;
import java.util.ArrayList;
public class Database {
private ArrayList licenseList = new ArrayList();
/
*
Your code goes here
*
/
public void printLicenses(){
License currLicense;
int i;
for (i =0; i < licenseList.size(); ++i){
currLicense = licenseList.get(i);
currLicense.print();
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!