I need help on my homework!

I need help on my homework for Computer Science 1! We use Eclipse


Your fruit stand has been amazingly successful! With the increased customer base, you have decided to branch out and sell as many different varieties of apples, oranges, and bananas as you can. Follow each of the following parts in turn...
Part 1
* You should have an Apple class; You will now extend this with 2 more classes: one for
oranges, and one for bananas. Each class will have the following...
* Data members for sweetness and size
* Both a default and non­default constructor
* 2 extra methods (of your design ­ have fun with it, but be appropriate)
Part 2
* To keep track of your new inventory, add 3 arrays to your FruitStand class...
i) apple_array, ii) orange_array, iii) banana_array
* These arrays should store Apples, Oranges, and Bananas, respectively * Be sure to initialize the arrays in the FruitStand constructor.
Part 3
* Add a new method to the FruitStand class to display your entire stock of fruit.
* public void show_stock()
* The method should iterate through each array of fruit, displaying the contents of all 3
arrays
* Be sure to call this new method in your Tester class


This is what I have so far:

- My Apple Class -

public class Apple {

private double weight;
private String color;
private String flavor;
private String sweetness;
private String size;

public Apple()
{
weight = 0.2;
color = "red";
flavor = "delicious";
}

public Apple(double w, String c, String f)
{
weight = w;
color = c;
flavor = f;
}

public void eat()
{
weight = 0.001;
color = "brown";
flavor = "";
}

public double applesauce()
{
return weight / 3;
}

public double smash (int lbs)
{
return weight * lbs * 1000;
}
}

- My Banana Class -

public class Bananas {

private double weight;
private String color;
private String flavor;
private String sweetness;
private String size;

public Bananas ()
{
weight = 1.1;
color = "yellow";
flavor = "sweet";
}

public Bananas (int x, String y, String z)
{
weight = x;
color = y;
flavor = z;
}

public void eat()
{
weight = .03;
color = "white";
flavor = "Sweet";
}

public void Smoothie()
{
weight = 2;
color = "whitesh - yellow";
flavor = "delicious";
}
}

- My Orange Class -


public class Oranges {

private double weight;
private String color;
private String flavor;
private String sweetness;
private String size;

public Oranges()
{
weight = 0.8;
color = "orange";
flavor = "sour";
}

public Oranges (int a, String b, String c)
{
weight = a;
color = b;
flavor = c;
}

public double peel()
{
return weight - 0.2;

}

public double juice()
{
return weight / 3;
}

}
Last edited on
I need help on my homework for Computer Science 1! We use Eclipse


We will be glad to help you with your Computer Science 1 homework using Eclipse; what would you like help with (*hint* ask a question)?

Additional Question:

What programming language are you using?
Java. Can you help me? It's due Thursday
this is a C++ Website...
what does that mean?
You should usually ask Java related questions on a Java website..

If you tell us exactly what you are having problems with (which you haven't done) we may be able to help though.
It means we generally don't help people who ask questions not related to C++...

However, I am willing to help you; just this once though. So I will ask again, what do you need help with?
I don't understand part 2&3. How do I keep track of the inventory with the arrays and how do you store and initialize the arrays?
Topic archived. No new replies allowed.