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
The exception of MS Access 2007 and above files is _ and older version are _ files ​
ohaa [14]

Answer:

Never heard of that kind of software, but I think it's an old file.

4 0
3 years ago
Anyone here good with PS4's?
Nookie1986 [14]
I can help you out ! What do you need to know bud ?
6 0
3 years ago
Read 2 more answers
If there is an value in a array, and the same value comes at the same spot, does it cancel each other out or does it reassing th
kondaur [170]

Explanation:

In simple English, an array is a collection.

In C also, it is a collection of similar type of data which can be either of int, float, double, char (String), etc. All the data types must be same. For example, we can't have an array in which some of the data are integer and some are float.

8 0
3 years ago
Which best describes the benefits of renting a home?
arlik [135]
The benefit of actually growing up.
5 0
3 years ago
Had you guys go to prom by yourself or someone in your senior class
Bess [88]

Answer: I didn’t have a “date”, I went with friends.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Make three statements about technology
    9·1 answer
  • What three characteristics of a function are described in an IPO chart? What is performed at each characteristic?
    12·1 answer
  • What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float?
    14·1 answer
  • Which of the following represent emerging classes of application software? Check all of the boxes that apply.
    9·3 answers
  • how to make assignment on power point plz cntct me and help me all about power point and my assignment is prime ministers of pak
    13·1 answer
  • What type of analysis should be used to respond to the statement, "Let's cut advertising by $1000 repeatedly so we can see its r
    14·1 answer
  • Analytical CRM systems are the input for operational CRM systems.<br><br> True<br><br> False
    11·1 answer
  • How important is the mail merge feature of microsoft word in different organization.?
    8·2 answers
  • True or false? The History list shows only Web pages you visited during the current computing session. -computer essentials
    7·1 answer
  • Question #5
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!