Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > return a string with a message when a constructor is executed

Reply
Thread Tools

return a string with a message when a constructor is executed

 
 
eleos eleos is offline
Junior Member
Join Date: Oct 2008
Posts: 2
 
      10-17-2008
With the method checkTaxStatus how can I output these message when the constructor is executed than call the method?.

public Car(String companyMake,String modelName,int milesPerGallon,int listPrice)
{
// initialise instance variables
make = companyMake;
model = modelName;
miles = milesPerGallon;
price = listPrice;
milometer = 0;
services = 0;
regNum = null;
name = null;
ownersNum = 0;
taxes = "taxes included";
notaxes= "no taxes";
}

* Return miles per gallon.
*/
public int getMiles()
{
return miles;
}

public String checkTaxStatus()
{
if(miles < 64 ){
return taxes;
}
else {
return notaxes;
}

}
 

Last edited by eleos; 10-17-2008 at 02:32 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display 'loading' message when scripts are executed and page is stillloading Nicolas R Javascript 4 04-30-2008 06:43 PM
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
return contents of executed parsed urls to variables Lis Javascript 0 08-29-2005 05:14 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
Prevent 'Chr(13) + Chr(10)' from Being Executed in String crjunk ASP .Net 2 08-08-2003 04:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57