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
How have productivity programs improved the professional lives of people? (check all that apply)
Zielflug [23.3K]

Productivity programs improved the professional lives of people because:

  • made it easier and faster to communicate with others
  • made it easier to manipulate numbers in a spreadsheet
  • made it easier and less expensive to present information

<h3>What is productivity?</h3>

Productivity is known to be the level of efficiency in regards to the production of goods or services and it is one that is rated by some measure.

Hence, Productivity programs improved the professional lives of people because:

  • made it easier and faster to communicate with others
  • made it easier to manipulate numbers in a spreadsheet
  • made it easier and less expensive to present information

Learn more about productivity from

brainly.com/question/14262252

#SPJ1

7 0
2 years ago
Rita wants to know the size of each image in a folder. Which view will help her find this information quickly?
vaieri [72.5K]
The correct answer would be details.

8 0
3 years ago
Our Client, a renowned trading company, suffered a sudden, devastating power outage that caused their server to cease functionin
Norma-Jean [14]

Answer:

Explanation:

I will consult the following strategies:

Step 1: Being a discerning consultant I should be knowing what exactly has caused the drive to get corrupted.

Step 2: After examining the current state of the hard drive I will explain the actual problem to the client in a very lucid and eloquent manner whether it is feasible to retrieve the lost data or it is beyond repair.

Step 3: Identify a solution to the problem with things at my disposal(finding a right tool).

Step 4: apply the solution found to retrieve the data from the hard drive.

Step 5: submitting the retrieved data from the corrupt drive to the customer and advocating them the preventive measures for future reference.

The above five steps will work perfectly to resolve the issue faced if followed with great care and being heedful of the situation at hand.

6 0
3 years ago
Given a vector of students, the function FinalAvg is supposed to return the average final exam score across all the students in
alexandr1967 [171]

Answer:

The C++ code is given below with appropriate comments

Explanation:

#define CATCH_CONFIG_MAIN //This tells Catch to provide a main()

#include"catch.hpp" //Header for Catch Framework

double FinalAvg( vector <int> students) // Function to calculate average.

{

double sum =0;

int i;

for( i=0;i<v.size();i++) sum+= v[i];

return v.empty() ? 0.0 : (double(sum)/ v.size());

}

vector<int> func(int argvq[ ]) // This function is made because we can not provide vector in command line argument that's why we used array which is then conerted into vector.

{

vector<int> v;

int j;

int l= sizeof(argvq)/sizeof(argvq[0]);

for(j=0;j<l;j++)

v.push_back(argq[j]);

return v;

}

TEST_CASE(" Final Average marks are computed","[func]") // TEST_ CASE macro to take one or more arguments

{

REQUIRE( func(9,5,-7) == 7); // We write our individual test assertions using the REQUIRE macro.

REQUIRE(func(2,4,6,-2) ==4);

}

Explanation Using different IDE:

#include<bits/stdc++.h>

using namespace std;

double FinalAvg(vector<int> students)

{

double sum=0;

for(int i=0;i<v.size();i++) sum+= v[i];

return v.empty() ? 0.0 : (double(sum)/v.size());

}

int main()

{

vector<int> v;

int i;

while(cin>>i&&i>0) v.push_back(i);

cout<<Final Avg(v);

return 0;

}

8 0
3 years ago
All of the following are ways to save money on transportation except :
Lisa [10]
The options listed are not related to the question. and if they were related in any sense then I would say the cheapest thing on the list is a phone card so I guess you can buy that and save the most for your travel as you can use phone cards anywhere as they have 1800 numbers which are free from any public phone. 
7 0
3 years ago
Other questions:
  • Write an interactive Python calculator program. The program should allow the user to type a mathematical expression, and then pr
    13·1 answer
  • The weird suspicious box that k12 sends the parents to put on the router. im getting strange privacy error messages on google an
    8·1 answer
  • In the spreadsheet example shown in chapter 5 ____ run from top bottom and are designated by a letter?
    12·2 answers
  • What operating system type uses icons to represent programs
    9·2 answers
  • To begin importing data from an excel spreadsheet, click on the ____ tab on the ribbon.
    11·1 answer
  • Complete the function void update (int *a, int *b), which reads two integers as argument, and sets a with the sum of them, and b
    8·1 answer
  • What was original name<br> whoever answers first gets brainly crown
    9·1 answer
  • In a finite state machine, state transitions happen only: a. When the reset causes a clock pulse on the D outputs of the flip-fl
    11·1 answer
  • I NEED THIS ASAP PLS
    12·1 answer
  • 40 points for this question
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!