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
You are trying to connect a new USB device to your computer. You install the driver and then connect the device to an open USB
nadezda [96]

Answer:

By order of increasing magnitude:

D. Make sure the USB device is plugged in properly.

A. Try a different USB cable.

B. Replace the USB device.

C. Install a new USB controller card.

Explanation:

Start with whatever is simplest first. Most errors are simply ID-10-T mistakes.

3 0
2 years ago
What tasks should a laptop accomplish?
Marta_Voda [28]

Answer:

general & personal used for computing.

3 0
3 years ago
Which of the following is true? Group of answer choices worst case time of Heapsort is better than worst cast time of Quicksort
Sav [38]

Answer:

Worst case time of Heapsort is better than worst case time of Quicksort.

Explanation:

Worstcase of Heapsort is nlog(n). Worstcase time of Quicksort is (n^2). Heapsort is comparison based sorting algorithm. Heapsort divides input into sorting. It is a selection sort in which we send maximum inputs for maximum elements at end. Quicksort is divide and conquer algorithm. It is considered as efficient sourcing algorithm.

8 0
3 years ago
Write a python program to calculate the length of any string recursively​
Solnce55 [7]

Answer:

b

Explanation:

6 0
2 years ago
Assuming that s and t are Strings, which of the following code fragments are such that the value returned by s.indexOf( t ) befo
KengaRu [80]

Answer:

What programming language is this

Explanation:

5 0
2 years ago
Other questions:
  • Which type of cable is described as a central conductor wire that is surrounded by insulating materials and placed inside a brai
    13·1 answer
  • What is the answer and why?
    12·1 answer
  • How does a content management system differ from a basic wysiwyg web authoring tool??
    11·1 answer
  • The method for updating the main memory as soon as a word is removed from the cache is called
    10·1 answer
  • Before its final commercial release, a(n) ________ version of software may be offered to certain test sites or to interested use
    6·1 answer
  • Design a full adder circuit using NAND gates only (input : A, B, Cin and output = S, Cout).
    5·1 answer
  • Consider the code fragment below. Show the values stored at each location in memory and as they change while the code executes.
    5·1 answer
  • HELP MEEE PLEASE!!!
    11·1 answer
  • second question today 25 POINTS: What is the formula to balance a lever when both effort and resistance are present?
    14·1 answer
  • _____ are fields that are used to personalize a mail merge document
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!