1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DIA [1.3K]
3 years ago
7

Write a class named grocerylist that represents a list of items to buy from the market. write another class called item that rep

resents a request to purchase a particular item in a given quantity (for example four boxes of cookies). the grocerylist class should use an array field to store items and to keep track of its size (number of the items in the list so far). assume that a grocery list will have no more than 50 items.
Computers and Technology
1 answer:
nataly862011 [7]3 years ago
5 0
Class Item {
// item class attributes
string itemName;
int itemQuantity;
double itemPrice;
...
}

class grocerylist {

// you can use arrays or any other containers like ArrayList, Vectors,...etc depends on programming language you use

Item[50] itemList;
int size;
public grocerylist () {
this.size = 0;
}
public void addItem(Item i) {
itemList[size] = i;
size = size +1;                      // Or size++
}
}
You might be interested in
Blank Are input instructions you give to a computer
kotegsom [21]

Explanation:

A computer is a machine that can be programmed to accept data (input), process it into useful information (output), and store it away (in a secondary storage device) for safekeeping or later reuse. The processing of input to output is directed by the software but performed by the hardware.

4 0
2 years ago
NEED HELP ASAP! BRAINLIEST AND 20 PTS TO CORRECT ANSWER!
son4ous [18]

The correct answer is C.

8 0
3 years ago
“What does it mean when we “rework” copyrighted material?”
Alja [10]
We use ideas and thoughts that have already been protected by the law which is called Copyright. We reworking copyright material means we are taking somebody's ideas and calling it ours. Which is not right by the law.
3 0
3 years ago
Read 2 more answers
Suppose a company A decides to set up a cloud to deliver Software as a Service to its clients through a remote location. Answer
finlep [7]

Answer:

perdonnosee

Explanation:

8 0
3 years ago
I'm making a game. I'm trying to make it so that instead of how I currently have it, starting whenever I click the screen, it st
Lera25 [3.4K]
That’s cool I’ll play the game tonight if I can
6 0
2 years ago
Other questions:
  • In addition to training on the products and on company policy, it does not make sense to be prepared to speak about your company
    6·2 answers
  • A company that manufactures machine parts order a new system that makes Products at ten times the speed of earlier machines. the
    13·2 answers
  • Which searching method requires that the list be sorted?
    5·1 answer
  • Write the definition of a method printarray, which has one parameter , an array of int s. the method does not return a value . t
    10·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • 30
    5·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    13·1 answer
  • What is the best temperature to set your air conditioner on?
    12·1 answer
  • Which one is correct
    8·1 answer
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!