0

```
import javax.swing.*;
import java.io.*;
import java.io.InputStreamReader;
public class Weight2
{
public static void main(String[] args)throws IOException
{
double cost;
double tax;
cost=Double.parseDouble(JOptionPane.showInputDialog("Enter purchase amount"));
double payment;
payment=Double.parseDouble(JOptionPane.showInputDialog("Enter amount tendered"));
BufferedReader CHANGE=new BufferedReader(new InputStreamReader(System.in));
tax=Double.parseDouble(CHANGE.readLine());
displayTax(getTax(cost,tax));
setPayment(payment);
setTax(tax);
setCost(cost);
displayCost(getCost(cost,tax));
System.exit(0);
}
public static double getTax(double y, double x)
{
double tax;
tax=x*0.06;
System.out.print("sales tax is:"+y);
return y;
}
public static void setTax(double y)
{
double tax;
tax=y;
}
public static double getCost(double x,double y)
{
double cost;
cost=x+y;
System.out.print("total cost is:"+x);
return x;
}
public static void setCost(double x)
{
double payment;
payment=x;
}
public static double getPayment(double a, double x)
{
double payment;
payment=x-a;
System.out.print("youre change is:"+a);
return a;
}
public static void setPayment(double a)
{
double cost;
cost=a;
}
public static double displayCost(double x)
{
JOptionPane.showMessageDialog(null,"Total cost:"+x);
return x;
}
public static void displayTax(double x)
{
JOptionPane.showMessageDialog(null,"with tax:"+x);
}
}
```

please help me with this.. theres no error but the methods doesn't function

*Edited 6 Years Ago by __avd*: Added [code] tags. Encase your code in: [code] and [/code] tags.