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
So if any of you kind gentlemen could enlighten me, i would really appreciate it.
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

This is my last resort. I need my grades

Its really bothering me. I cant sleep
Help!
-Dianne