Anu pearson

Greenhorn
+ Follow
since May 09, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anu pearson

Ernest and Dirk,
Thanks for your replies...
SOrry if the quality of the posting wasnt upto the mark ...and I apologize for the incomplete follow-up that I just inadverently posted....I am still learning the ropes and promise to do better.
Here are additional specific details regarding the sample program that I stuff I am trying to do
The code has three parts to it.
A) the main() method
B) the Income_calc method
C) the Month method
Of these, I only have edit priveledges to the Income_calc method.
I can get the code to compile...however, the problem that I am facing is with respect to turning on/turning off the Debug messages.
There are two distinct things that I am grappling with:
i) Trying to toggle the debug messages from the Income_calc method.
ii) Trying to toggle the debug messages from the Month method.

A) The "main()" method :
This simply instantiates the Tax_calc class :


B) The second part is a predefine class of methods called "Month". This class contains a method called debug and its constructor turns on debug_flag.

c) The third part is the class called Income. This class also contains a method

19 years ago
Ernest and Dirk,
Thanks for your replies...
SOrry if the quality of the posting wasnt upto the mark ...I am still learning the ropes and promise to do better.
Here are additional specific details regarding the sample program that I stuff I am trying to do
The code has three parts to it...
A) The "driver" program if you will :
This simply instantiates the Tax_calc class :


B) The second part is a predefine class of methods called "Month":
[code]public class Tax_calc
{
private boolean debug_flag;
//constructor
public Tax_calc
{
debug_flag = true;
show_values();
}
// instantiate the "Month class"
Month may2004;
may2004 = new Month;
//show_values method
public void show_values
{
debug("show calculated values");
}
// debug message method
public void debug(boolean on)
{
if(debug_flag)
{
System.out.println("Tax_Calc:" + message);
}
}
}
19 years ago
I have the following code structure in which two classes are defined along with the main() method.
The class "Month" is instantiated in a class called "Tax_calc". Tax_calc is itself instantiated inside "main()".
Both the Tax_calc and Month classes have debugging messages turned on by default.
I am unable to figure out to turn off the debugging messages in BOTH classes - Tax_calc and also Income.
Would greatly appreaciate pointers on how to do this...
TIA
Anu
----------- Code structure --------------
public static void main(String[] args)
{
Tax_calc yr_2004;
yr_2004 = new Tax_calc;
}
public class Tax_calc
{
private boolean debug_flag;
//constructor
public Tax_calc
{
debug_flag = true;
show_values();
}
// instantiate the "Month class"
Month may2004;
may2004 = new Month;
//show_values method
public void show_values
{
debug("show calculated values");
}
// debug message method
public void debug(boolean on)
{
if(debug_flag)
{
System.out.println("Tax_Calc:" + message);
}
}
}
public class Income
{
private boolean debug_flag;

System.out.println("This is just a test\n");

public void toggleDebugMode(boolean on)
{
debug_flag = on;
}
public void debug( String message);
{
if(debug_flag)
{
System.out.println(message);
}
}
}
19 years ago