in class Song, write the calculation in method getEstEarnings of class Song to evaluate estimated earnings. Note that while in the real world, other methods would be used to estimate earnings, in this simplified model, the estimated earnings will be the length of the title, multiplied by the a value extracted by the ministry using the method getSongPartEst(hint.. the singer keeps a reference to the ministry. You can observe how the reference is used in method getClaimableEarnings). public int getEstEarnings() { return 0;//Q2. Perform this calculation } public int getClaimableEarnings() { int est = getEstEarnings(); if (est > singer.getMinistry().getMinClaimable()) return est; else return 0; }
in class Song, write the calculation in method getEstEarnings of class Song to evaluate estimated earnings. Note that while in the real world, other methods would be used to estimate earnings, in this simplified model, the estimated earnings will be the length of the title, multiplied by the a value extracted by the ministry using the method getSongPartEst(hint.. the singer keeps a reference to the ministry. You can observe how the reference is used in method getClaimableEarnings).
public int getEstEarnings() {
return 0;//Q2. Perform this calculation
}
public int getClaimableEarnings() {
int est = getEstEarnings();
if (est > singer.getMinistry().getMinClaimable())
return est;
else
return 0;
}
Step by step
Solved in 3 steps