Beginner Help

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 5
Reputation: chihwei is an unknown quantity at this point 
Solved Threads: 0
chihwei chihwei is offline Offline
Newbie Poster

Beginner Help

 
0
  #1
Jun 11th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Beginner Help

 
0
  #2
Jun 11th, 2007
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!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 5
Reputation: chihwei is an unknown quantity at this point 
Solved Threads: 0
chihwei chihwei is offline Offline
Newbie Poster

Re: Beginner Help

 
0
  #3
Jun 11th, 2007
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 ?
Last edited by chihwei; Jun 11th, 2007 at 11:14 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Beginner Help

 
0
  #4
Jun 12th, 2007
access modifiers...
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 59
Reputation: Chaster is an unknown quantity at this point 
Solved Threads: 3
Chaster Chaster is offline Offline
Junior Poster in Training

Re: Beginner Help

 
0
  #5
Jun 15th, 2007
Ok.
I think you forgot the public keyword. Maybe you should declare your method like this:
  1. public static String makeFullNumber(String aNumber, int aCode)
  2. {
  3. return aNumber + " - " + aCode;
  4. }
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 13
Reputation: msi_333 is an unknown quantity at this point 
Solved Threads: 1
msi_333's Avatar
msi_333 msi_333 is offline Offline
Newbie Poster

Re: Beginner Help

 
0
  #6
Jun 15th, 2007
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 ) ??
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Beginner Help

 
0
  #7
Jun 16th, 2007
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...
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 13
Reputation: msi_333 is an unknown quantity at this point 
Solved Threads: 1
msi_333's Avatar
msi_333 msi_333 is offline Offline
Newbie Poster

Re: Beginner Help

 
0
  #8
Jun 16th, 2007
"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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 83
Reputation: ProgrammersTalk is an unknown quantity at this point 
Solved Threads: 7
ProgrammersTalk's Avatar
ProgrammersTalk ProgrammersTalk is offline Offline
Junior Poster in Training

Re: Beginner Help

 
0
  #9
Jun 17th, 2007
Originally Posted by chihwei View Post
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
The ProgrammersTalk Community | Programming & Marketing | Buying & Selling Script
Hang out place of novice and intermediate programmers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC