| | |
Beginner Help
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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 |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class classes client code color compare component coordinates database detection doctype eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java java.xls javaexcel javaprojects jni jpanel jtextarea julia keytool linux list loop map method methods mobile netbeans newbie nextline object pong print problem producer program programming project projectideas recursion recursive replaysolutions rim scanner screen sell server set size sms sort sql string swing terminal threads tree web websites windows






