Certificate.java public class Certificate { private String holder; private int level; public void setHolderAndLevel(String newHolder, int newLevel) { holder = newHolder; level = newLevel; } public void print() { System.out.println("Certificate: " + holder + ", Level: " + level); } } -- SOLVE BELOW -- Certificates.java import java.util.Scanner; import java.util.ArrayList; public class Certificates { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); ArrayList certificateList = new ArrayList(); Certificate currCertificate; String currHolder; int currLevel; int certificateCount; int i; certificateCount = scnr.nextInt(); for (i = 0; i < certificateCount; ++i) { currHolder = scnr.next(); currLevel = scnr.nextInt(); currCertificate = new Certificate(); currCertificate.setHolderAndLevel(currHolder, currLevel); certificateList.add(currCertificate); } /* Your code goes here */ } }
Certificate.java
public class Certificate {
private String holder;
private int level;
public void setHolderAndLevel(String newHolder, int newLevel) {
holder = newHolder;
level = newLevel;
}
public void print() {
System.out.println("Certificate: " + holder + ", Level: " + level);
}
}
-- SOLVE BELOW --
Certificates.java
import java.util.Scanner;
import java.util.ArrayList;
public class Certificates {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
ArrayList<Certificate> certificateList = new ArrayList<Certificate>();
Certificate currCertificate;
String currHolder;
int currLevel;
int certificateCount;
int i;
certificateCount = scnr.nextInt();
for (i = 0; i < certificateCount; ++i) {
currHolder = scnr.next();
currLevel = scnr.nextInt();
currCertificate = new Certificate();
currCertificate.setHolderAndLevel(currHolder, currLevel);
certificateList.add(currCertificate);
}
/* Your code goes here */
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images