hai everyone .

i tried to do this Example in (last year exam)

i hope you can help me doing it for learning

 this example for Market class


want to create Market class with a name of vegetable in an Array of
String type, Stock of vegetables in an array of interts type and cost
of vegetables in an array of double type.

 -method that can choose the order of vegetable selected by the user
and return the price of the vegetable.
-  method that can provide the option of kowing the stock availability
of the vegetable when the order of the vegetable is given as
parameter.
  - method that can revice and order of the vegetable and the number
of items reqired .the price of the vegetable purchased with complete
details of the vegetable should be returned. once the stock of sales
occure the stock should be reduced for that vegetable . Promt the user
for the insufficient stock of vegetable.


**
then in Client class , use menu driven program with proper validation
of all inputs .




public class Market {
    private int num[], index;

    public Market (int size) {
        num = new int[size];
        index = -1;
    }



    public boolean isFull() {
       return index == num.length - 1;
    }

    public boolean add(int elem) {
        if(!isFull()) {
            num[++index] = elem;
            return true;
        }
        return false;
    }
    public String print() {
        String collect = "";
        for(int i = 0; i < num.length; i++) {
            collect += (i + 1) + "\t" + num[i] + "\n";
        }
        return collect;
    }



 public  int chooseOrderl(int price) {
      ///

    }

public  boolean stockAv(int stock) {
      ///
  return true;

    }


>
>



}











-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to