public class InputData {

    String[] descr = {"Apples", "Bananas", "Berries", "Grapes", "Lemons", "Lime", "Melons", "Nectarines", "Oranges", "Peaches", "Pears", "Plums", "Strawberries", "Watermelon", "Asparagus", "Broccoli", "Cabbage", "Carrots", "Cauliflower", "Celery", "Corn", "Garlic", "Lettuce", "Mushrooms", "Onions", "Peppers", "Potato", "Squash", "Sweet Potato", "Tomatoes", "Zucchini", "Cherries", "Mixed Fruit", "Peaches", "Pears", "Pineapples", "Asparagus", "Carrots", "Corn", "Greenbeans", "Peas", "Potatoes", "Tomatoes", "Baked Beans", "Butter Beans", "Green Beans", "Kidney Beans", "Pinto Beans", "PorkNBeans", "String Beans", "Broccoli", "Carrots", "Corn", "Dinners", "French Fries", "Ice Cream", "Mixed Veg.", "Peas", "Pizza", "Tater Tots", "Chicken", "Corned Beef", "Ham", "Salmon", "Tuna", "Vienna Sausage", "Boneless Breast", "Breast with Bone", "Legs", "Whole Chicken", "Wings", "Ground", "Hamburger", "Roast", "Steaks"};
    int[] priceCents;
    int[] prodID;
    int[] soldUnits;
    int current;

    public InputData() {
        priceCents = new int[descr.length];
        prodID = new int[descr.length];
        soldUnits = new int[descr.length];

        current = 0;

    private void populate() {
        int i;
        for (i=0; i<descr.length; i++)
            priceCents[i] = (int)(Math.random()*1000+1);
            prodID[i] = (int)(Math.random()*1000000000);
            soldUnits[i] = (int)(Math.random()*200);

    public boolean next()
        if (current==descr.length-1)
            return false;

        return true;

    public int getPriceCents() {
        return priceCents[current];

    public int getProdID() {
        return prodID[current];

    public String getDescription() {
        return descr[current];

    public int getUnitsSold() {
        return soldUnits[current];

Create a Class named "product" that stores:
1. product name
2. product id (9. digit integer)
3. product price in cents
4. Number of units sold

write a class shop, which contains an array of product and the name of the shop. both must be private. write two methods named Addproduct, that add a product to the shop
1. the first method takes in input a product object
2. the second takes in input the product id , name, price and unit sold

write a new class salesreport. this class has the main method of the program salesReport contains two instances of inputData which as shown on the code above named input1 and input2 corresponding to the product of two shops

Add the following methods to the shop
. AveragePrice, which returns the average selling prices for all items sold at that shop .
. maxPrice, which returns the price of the most expensive product sold at the shop.
1.5 Add method Show sales report to shop . for each item, this method prints the description, price, and number of units sold.sort the output by number of sales, in descending order
use method ShowsalesReport to print sales report for Shop1Data and Shop2Data

write a little note on how you designed the method and how to use the method

Recommended Answers

you forgot to mention what you're having trouble with. what is your actual question, and I don't mean: re-post your assignment.

Jump to Post

All 3 Replies

you forgot to mention what you're having trouble with. what is your actual question, and I don't mean: re-post your assignment.

Welcome to DaniWeb.
Although your problem may be urgent to you, screaming for help help help isn't going to make it urgent for anyone here. You will get better results from a calm clear request (eg exactly what help do you need).

Anyway - you posted a homework assignment, and a class that doesn't match anything in the assignment description. Very interesting, but so what?

If you need help you can't expect us to guess what help you need. Ask the question. But first check the DaniWeb Member Rules (which you agreed to when you signed up),, in particular:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"

Did you at least attend the lectures and do the readings?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.