|
Number Basics
Create a new BlueJ class called NumberBasics and paste the code below inside. Compile and run the class to see what it does. Your job is to
- 1) make the constructore initialize the two instance variables numOne and numTwo
- 2) make the three methods sum(), difference() and average() work!
NumberBasics
public class NumberBasics
{
double numOne;
double numTwo;
public NumberBasics(double first, double second)
{
}
//@ returns sum of numbers
public double sum(){
System.out.println("Change this to return the sum of these numbers");
return 1;
}
//@ returns difference of numbers
public double difference(){
System.out.println("Change this to return the difference of these numbers");
return 1;
}
//@ returns average of numbers
public double average(){
System.out.println("Change this to return the average of these numbers");
return 1;
}
}
|