considering my prof asked the question below, I wrote the code (also shown
below)..... however it is wrong......so I any help as to where I'm going
wrong will be appreciated
Question Asked:
=============== ==
Write the definition of a class Telephone. The class has no constructors,
one instance variable of type String called number, and two 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.
The method accepts two arguments, a String containing a telephone number and
an int containing an area code. The method concatenates the two arguments in
the following manner: First comes the area code, then a dash, then the
telephone number. The method returns the resultant string.
(cannot initiate your own identifier for code and number --- because it
returns errors)
Answer Given:
=============== ==
class Telephone {
String number;
static int quantity;
static double total;
static String makeFullNumber( ){
return "416-"+number;
}
}
below)..... however it is wrong......so I any help as to where I'm going
wrong will be appreciated
Question Asked:
=============== ==
Write the definition of a class Telephone. The class has no constructors,
one instance variable of type String called number, and two 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.
The method accepts two arguments, a String containing a telephone number and
an int containing an area code. The method concatenates the two arguments in
the following manner: First comes the area code, then a dash, then the
telephone number. The method returns the resultant string.
(cannot initiate your own identifier for code and number --- because it
returns errors)
Answer Given:
=============== ==
class Telephone {
String number;
static int quantity;
static double total;
static String makeFullNumber( ){
return "416-"+number;
}
}
Comment