Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have two questions that im not able to do it in java.Anyhelp would be great th

ID: 3609200 • Letter: I

Question

I have two questions that im not able to do it in java.Anyhelp would be great thanks. 1)Write the definitionof a class Telephone . The class has no constructors and onestatic method getFullNumber . The method accepts a Stringargument and returns it, adding 718- to the beginning of theargument. 2)Write the definitionof a class Telephone . The class has no constructors, oneinstance variable of type String called number , andtwo static variables. One is of type int called quantity ; the other is of type double called total .Besides that, the class has one static method makeFullNumber . Themethod accepts two arguments, a String containing a telephonenumber and an int containing an area code. The methodconcatenates the two arguments in the following manner: First comesthe area code, then a dash, then the telephone number. The methodreturns the resultant string. I have two questions that im not able to do it in java.Anyhelp would be great thanks. 1)Write the definitionof a class Telephone . The class has no constructors and onestatic method getFullNumber . The method accepts a Stringargument and returns it, adding 718- to the beginning of theargument. 2)Write the definitionof a class Telephone . The class has no constructors, oneinstance variable of type String called number , andtwo static variables. One is of type int called quantity ; the other is of type double called total .Besides that, the class has one static method makeFullNumber . Themethod accepts two arguments, a String containing a telephonenumber and an int containing an area code. The methodconcatenates the two arguments in the following manner: First comesthe area code, then a dash, then the telephone number. The methodreturns the resultant string. 2)Write the definitionof a class Telephone . The class has no constructors, oneinstance variable of type String called number , andtwo static variables. One is of type int called quantity ; the other is of type double called total .Besides that, the class has one static method makeFullNumber . Themethod accepts two arguments, a String containing a telephonenumber and an int containing an area code. The methodconcatenates the two arguments in the following manner: First comesthe area code, then a dash, then the telephone number. The methodreturns the resultant string.

Explanation / Answer

/*this is what you asked for,exactly *1) */ public class Telephone { public static String getFullNumber(String s) { return ("718-"+s); // This line adds718- to the string and returns it } }

// 2)
public class Telephone { String number; //instancevariable static int quantity; //staticvariable static double total; //staticvariable public static String makeFullNumber(String num, intarea) { return (area + "-" + num); } }