Answer:
This is the missing method createLicenseNum()
public void createLicenseNum(int customID){
// the function createLicenseNum() with int type parameter customID
licenseNum = (100000 * customID) + licenseYear; }
//the formula for creating license number
Step-by-step explanation:
The whole program is given below:
public class DogLicense {
private int licenseYear;
private int licenseNum;
public void setYear(int yearRegistered) {
licenseYear = yearRegistered;
return; }
public void createLicenseNum(int customID){
licenseNum = (100000 * customID) + licenseYear; }
public int getLicenseNum() {
return licenseNum; } }
public class CallDogLicense {
public static void main (String [] args) {
DogLicense dog1 = new DogLicense();
dog1.setYear(2014);
dog1.createLicenseNum(777);
System.out.println("Dog license: " + dog1.getLicenseNum());
return; } }
The class DogLicense has two private int type variables licenseYear and licenseNum. It has three methods, setYear() which sets the licenseYear to yearRegistered, createLicenseNum() which is used to create a license number according to the given formula and has a parameter customID, getLicenseNum() which returns the license number which is created in the createLicenseNum().
The class CallDogLicense has a main function and an instance dog1 of class DogLicense. The object calls setYear() function to set the value of licenseYear as 2014 and calls createLicenseNum and passes value of customID as 777.
Finally getLicenseNum() function is called which returns the LicenseNum value and the output is Dog license: 77702014
The program output is attached as a screenshot.