| | |
Beginner Help
![]() |
•
•
Join Date: Jun 2007
Posts: 5
Reputation:
Solved Threads: 0
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.
How about asking a specific question and showing the code you have written. Otherwise we aren't going to do your homework for you.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jun 2007
Posts: 5
Reputation:
Solved Threads: 0
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 ?
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 ?
Last edited by chihwei; Jun 11th, 2007 at 11:14 pm.
•
•
Join Date: Jun 2007
Posts: 59
Reputation:
Solved Threads: 3
Ok.
I think you forgot the public keyword. Maybe you should declare your method like this:
I think you forgot the public keyword. Maybe you should declare your method like this:
Java Syntax (Toggle Plain Text)
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 ) ??
Just walk beside me and be my friend
Programming forums,phpbb3 Styles,
Java Forums,Web Development Forums
Programming forums,phpbb3 Styles,
Java Forums,Web Development Forums
"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
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
Just walk beside me and be my friend
Programming forums,phpbb3 Styles,
Java Forums,Web Development Forums
Programming forums,phpbb3 Styles,
Java Forums,Web Development Forums
•
•
•
•
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.
The ProgrammersTalk Community | Programming & Marketing | Buying & Selling Script
Hang out place of novice and intermediate programmers
Hang out place of novice and intermediate programmers
![]() |
Similar Threads
- What program language should a beginner use? (IT Professionals' Lounge)
- C++ Beginner - #include recursion problem (C++)
- MS Access Beginner (MS SQL)
- PHP Beginner Here (PHP)
- beginner (C++)
- Beginner's questions: C++ and databases (C++)
- beginner needs help with game programming (Game Development)
Other Threads in the Java Forum
- Previous Thread: how to call a method defined in another file?
- Next Thread: help w/ images on buttons
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






