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
Which of the following is true?
DENIUS [597]
D is the answer

Hope this helps
4 0
2 years ago
Phân tích cạnh tranh của cocacola và pepsi
Fittoniya [83]
I don’t understand please speak English
7 0
2 years ago
How to ask for a letter of recommendation via email?
Katarina [22]
This can be done in a number of steps.

1. Prepare your email request early.
2. Choose an appropriate professor
3. Address the letter properly.
4. Put "Recommendation for [your name]" as the subject line.
5. Start the first paragraph by stating what you want.
6. Outline your relationship with the professor.
7. Use the third paragraph as an opportunity to hint at what you'd like the professor to say about you.
8. Give the details.
9. Close with information about how you will follow-up.
10. Thank the professor, whether or not s/he writes the letter.
11. Follow through as promised by delivering necessary materials and sending a reminder
12. Take responsibility for checking with the scholarship program, graduate school, or prospective employer before the deadline
1. Thank the professor again.
5 0
3 years ago
A function checkZeros accepts three double parameters. It checks to see if the sum of all three parameters is equal to zero. If
blagie [28]

Answer:

Explanation:

The following code is written in Java. It creates the interface/prototype, the function, and the main method call. The function takes in the three int parameters, adds them, and then checks if the sum equals zero, outputting the correct boolean value. Output can be seen in the picture attached below. Due to technical difficulties I had to add the code as a txt file below.

6 0
2 years ago
Samuel was hired to create a program that asks the user questions and, based on the answers, recommend a book to read. What kind
quester [9]

Answer:

I think the answer is C

Explanation:

Selection

3 0
3 years ago
Other questions:
  • Write a function called ReverseLetters that takes an input phrase consisting of a single word and reverses the sequence of lette
    15·1 answer
  • Universal Containers is setting up an external Business Intelligence (BI) system and wants to extract 1,000,000 Contact records.
    11·1 answer
  • Page orientation can be either landscape or _____.
    13·1 answer
  • A) A cable that is mainly used in the cable television network
    11·1 answer
  • A ______ is a computer that controls access to the hardware, software, and other resources on a network. mainframe server workst
    10·1 answer
  • What do you do when your computer shuts down
    15·2 answers
  • User defined blocks of code can be created in
    13·1 answer
  • Can someone help me with python
    10·1 answer
  • State the difference between font colour and shading.​
    15·1 answer
  • A(n) ____ is a live internet presentation that supports interactive communications between the presenter and the audience.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!