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.

Recommended Answers

All 8 Replies

How about asking a specific question and showing the code you have written. Otherwise we aren't going to do your homework for you.

Sorry ...first time post

the code i wrote :
==============
class Telephone{
String number ;
static int quantity;
static double total;
static String makeFullNumber(){
return quantity+"- "+n;
}
}
========
i don't how come it can't find the makeFullNumber ?

access modifiers...

Ok.
I think you forgot the public keyword. Maybe you should declare your method like this:

public static String makeFullNumber(String aNumber, int aCode)
{
    return aNumber + " - " + aCode;
}

Writing "public " (Access- Modifiers ) , is not the error here .The class can be written with out it and it will be friendly by default (Can be Accessed inside the same package ) ??:icon_exclaim:

don't go rambling about things you don't understand...

The fact that you end your statement with several question marks means you shouldn't have made it...

"you don't understand..." :@ it is not good to say that for a one u don't know anything about him , just the user name . and the questions marks it was my mistake , and as u see also i put big wondering notations,

thanks

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.

it's an instance variable, add private before you declare String :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.