eugene007
asked on
calculation
This code can be found in HealthClinic.java. The code bellow is suppose to do the following:
If the status attribute for the patient already refers to this health clinic, he/she is charged a standard fee for a consultation, given by the fee attribute.
If the patient is private, there is no change to their balance attribute.
if the patient is not private, the fee multiplied by the gapPerCent attribute is deducted from their balance. For example, if the fee attribute of the HealthClinic is $50, and the gapPerCent is 10.0, then the balance attribute of the patient is reduced by $5.
public void visit(Patient p)
{
if(p.getmedicalFacility()= =null)
{
register(p);
}
else
{
if(p.getprivateFund()==tru e)
{
p.setBalance(p.getBalance( ) + getFee());
}
else
{
p.setBalance(p.getBalance( ) + (getFee() * getgapPerCent()));
}
consultation(p);
}
}
Does my code do that?. If no how do I solve the problem.
You can download the latest code from:
www.mutaiyas.com/db/Medical.zip
Your help is kindly appreciated.
Regards
Eugene
If the status attribute for the patient already refers to this health clinic, he/she is charged a standard fee for a consultation, given by the fee attribute.
If the patient is private, there is no change to their balance attribute.
if the patient is not private, the fee multiplied by the gapPerCent attribute is deducted from their balance. For example, if the fee attribute of the HealthClinic is $50, and the gapPerCent is 10.0, then the balance attribute of the patient is reduced by $5.
public void visit(Patient p)
{
if(p.getmedicalFacility()=
{
register(p);
}
else
{
if(p.getprivateFund()==tru
{
p.setBalance(p.getBalance(
}
else
{
p.setBalance(p.getBalance(
}
consultation(p);
}
}
Does my code do that?. If no how do I solve the problem.
You can download the latest code from:
www.mutaiyas.com/db/Medical.zip
Your help is kindly appreciated.
Regards
Eugene
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
but your code does it right. maybe you just have inverse balances...
ASKER
public void visit(Patient p)
{
if(p.getmedicalFacility()= =null)
{
register(p);
}
else
{
consultation(p);
if(p.getprivateFund()==tru e)
{
p.setBalance(p.getBalance( ))
}
else
{
p.setBalance(p.getBalance( ) - (getFee() * getgapPerCent()));
}
}
}
public void consulatation(Patient p)
{
p.setBalance(p.getBalance( )-getFee() );
unregister(p);
}
{
if(p.getmedicalFacility()=
{
register(p);
}
else
{
consultation(p);
if(p.getprivateFund()==tru
{
p.setBalance(p.getBalance(
}
else
{
p.setBalance(p.getBalance(
}
}
}
public void consulatation(Patient p)
{
p.setBalance(p.getBalance(
unregister(p);
}
ASKER
Is this much better.
ASKER
I figured it out.
How do I change a negative value to a positive value?
How do I change a negative value to a positive value?
a=(a<0?-a:a)
or a=-a, if you want to change positives to negatives, too
ASKER
p.getBalance()
will return a negative or positive value. If it returns a negative value how do I change it to positive using the method which u have explained.
will return a negative or positive value. If it returns a negative value how do I change it to positive using the method which u have explained.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
boolean negative = (i < 0); so by this can determent if a value is positive or negative.
ASKER
I also found out about negate() function.
I hope, you succeed with your program. Is it for a course?
ASKER
Well Im into asp 3.0 actually. Since im interested to use asp.net, therefore im learning java. Then ill move on to c#.
Regards
Eugene
Regards
Eugene