Solved:

Checkmark

Answered by AI, Verified by Human Experts

Write a second constructor as indicated. Sample output:User1: Minutes: 0, Messages: 0User2: Minutes: 1000, Messages: 5000// ===== Code from file PhonePlan.java =====public class PhonePlan { private int freeMinutes; private int freeMessages; public PhonePlan() { freeMinutes = 0; freeMessages = 0; } // FIXME: Create a second constructor with numMinutes and numMessages parameters. /* Your solution goes here */ public void print() { System.out.println("Minutes: " + freeMinutes + ", Messages: " + freeMessages); return; }}

Write a second constructor as indicated. Sample output:User1: Minutes: 0, Messages: 0User2: Minutes: 1000, Messages: 5000// ===== Code from file PhonePlan.java =====public class PhonePlan { private int freeMinutes; private int freeMessages; public PhonePlan() { freeMinutes = 0; freeMessages = 0; } // FIXME: Create a second constructor with numMinutes and numMessages parameters. /* Your solution goes here */ public void print() { System.out.println("Minutes: " + freeMinutes + ", Messages: " + freeMessages); return; }}

Answer:The code to this question can be given as:Second constructor code:PhonePlan(int min,int messages) //define parameterized constructor and pass integer variables.{freeMinutes = min;   //variable holds value of parameter.freeMessages = messages;  //variable holds value of parameter.}Explanation:In the question, It is given that write a second constructor. So, the code for this question is given above that can be described as:In this code, we define a parameterized constructor that is "PhonePlan()". In this constructor, we pass two integer variable that is min and message. The constructor name same as the class name and it does not return any value.In this constructor, we use the variable that is defined in the PhonePlan class which is "freeMinutes and freeMessages". This variable is used for holding the parameter variable value....

Unlock full access for 72 hours, watch your grades skyrocket.
For just $0.99 cents, get access to the powerful quizwhiz chrome extension that automatically solves your homework using AI. Subscription renews at $5.99/week.