Please help me solve these Java Problems

Hi guys, my name is Dianne and im from the philippines. ;)

Our teacher Gave us these problems in our java class and said she wont give us our prelims grades if we dont solve them. :(

Im really new with Java and im having a hard time solving them. I tried to but the problem says that i should use **Methods** and as i try to understand it, i just couldnt get it :confused:

So if any of you kind gentlemen could enlighten me, i would really appreciate it.:p

Its just two problems:

1.Write a Java Program that calculates the change for a cashier. The program requests the cost of the item. The user then types in the cost. The program then outputs the cost of the item including the sales tax (use 6% as the sales tax value). The program next requests and recieves the amount tendered by the customer. Finally, the program outputs a summary of all figures, including the amount of change due to the customer. Name the program as Change.java.

This program has the following attributes and methods:

double cost;

double tax;

double payment;

double getCost();

double getTax();

double getPayment();

void setCost (double x)

void setTax (double x)

void setPayment (double x)

2. Create a java program named Numbers whose main() method holds two integer variables. Assign values to the variables. Pass both variables to methods named sum() and difference(). Create the methods sum() and difference(); these compute the sum and difference between the values of two arguments, respectively. Each method should perform the appropriate computation and display the results. Name the program as Numbers.java.

Guys i really really tried hard to sovle these problems. But to no avail :mad:

This is my last resort. I need my grades :( Its really bothering me. I cant sleep :(

Help! :(

-Dianne

Re: Please help me solve these Java Problems

Create an application named Numbers whose main() method holds two integer variables. Assign values to the variables. Pass both variables to methods named sum() and difference(). Create the methods sum() and difference(); they compute the sum of and difference between values of two arguments, respectively. Each method should perform the appropriate computation and display the results. Save the application as Numbers.java. Add a method named product() to the Numbers class. The product() method should compute the multiplication product of two integers, but not display the answer. Instead, it should return the answer to the calling method, which displays the answer. Save the application as Numbers.java.

i need to answer

Re: Please help me solve these Java Problems

@rua: please start your own thread; don't resurrect an old zombie thread; I'm closing this one.

kind regards,

Jos