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
olya-2409 [2.1K]
4 years ago
10

Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week. For thi

s Programming Project, define the class Box Of Produce that contains exactly three bundles of fruits or vegetables. You can represent the fruits or vegetables as an array of type string. Add accessor and mutator functions to get or set the fruits or vegetables stored in the array. Also write an output function that displays the complete contents of the box on the console.
Next, write a main function that creates a Box Of Produce with three items randomly selected from this list:
Broccoli Tomato Kiwi Kale Tomatillo.
This list should be stored in a text file that is read in by your program. For now you can assume that the list contains exactly five types of fruits or vegetables. Do not worry if your program randomly selects duplicate produce for the three items.
Next, the main function should display the contents of the box and allow the user to substitute any one of the five possible fruits or vegetables for any of the fruits or vegetables selected for the box.
After the user is done with substitutions output the final contents of the box to be delivered.
Computers and Technology
1 answer:
sukhopar [10]4 years ago
6 0

Answer:

C++.

Explanation:

class BoxOfProduce {

private:

   string fruit_bundles[3][5];

////////////////////////////////////////////////////////////////////////

public:

   // Methods  1, 2 and 3

   void setFruit(string fruit, int bundle, location) {

       self.fruit_bundles[bundle][location] = fruit;

   }

   string getFruit(int bundle, int location) {

       return self.fruit_bundles[bundle][location];

   }

   void printBundle(int bundle) {

       cout<<"Bundle "<<i<<endl;

       for (int j = 0; j < 5; j++) {

           cout<<fruit_bundles[bundle][j]<<", ";

       }

       cout<<endl;  

   }

};

////////////////////////////////////////////////////////////////////////

// Main

int main() {

   BoxofProduce box_of_produce1;  

   

   // Get fruit names from file and add to box_of_produce1

   ifstream myfile("fruitList.text");

   int line_number = rand() % 5 + 1;

   string fruit;

   if (myfile.is_open()) {

       for (int i = 1; i <= line_number; i++)  {

           getline(myfile, fruit);

        }

   }

   box_of_produce1.setFruit(fruit, 1);

   // Print contents of bundle 1

   box_of_produce.printBundle1(1);

   

   // Left one - Allow the user to substitute any one of the five possible fruits or vegetables for any of the fruits or vegetables selected for the box.

   return 0;

}

You might be interested in
PLEASE HELP!!!! I'll mark Brainliest for whoever is first!!!!
Otrada [13]

Answer:

It counts the number of birds in the list.

7 0
3 years ago
Read 2 more answers
The storage capacity of Go ogle drive can be increased from ____________.
maks197457 [2]

Answer:

c. 100GB to 30TB

Explanation:

Please mark me as brainliest and hope this helps :)

4 0
3 years ago
12) The Windows utility returns your computer to the state it was in when it came from the factory. Erase Refresh Reset Backup N
Ludmilka [50]

Answer:

Reset

Explanation:

3 0
3 years ago
Why is a non-trivial or predictable classification system preferred in systematics?
spayn [35]
A non-trivial or predictable classification system is preferred in systematics for the reason that, it is <span> repeatable, objective, testable and </span>predictable. Predictable in a way that you <span>get more out of it than what you put in it. Hope this answers your question.</span>
4 0
3 years ago
Identify a true statement about decision support systems (DSSs).
Zolol [24]

Answer:

a. facilitate improvements but do not necessarily cause them.

Explanation:

Decision Support Systems are interactive Information systems that assist  decision makers in coming up with strategies that help the organisation achieve its goals .The model base of the DSS uses mathematical and statistical models to analyse information then it generates reports and suggest possible solutions that can be implemented .The system is capable of giving a specific solution and some even allow the decision makers to give input before suggesting the most applicable solution.The effectiveness of a DSS is equally as important as its efficiency .The DSS unlike the conventional decision-making process should be able to analyse information effectively and come up with solutions in the shortest possible time frame.

7 0
4 years ago
Other questions:
  • You created a database related to medicinal plants and their uses. For every plant, you would like to enter a description about
    11·1 answer
  • According to the article words have the power to change people's behavior. Describe one example of this from the article
    6·1 answer
  • The set of folders and subfolders that MATLAB searches through to locate a command or M-file is called the ___________.(fill in
    9·1 answer
  • If a driver who is under the age of 21 is stopped by a law enforcement officer and shown to have a BAL of .02 or greater, he or
    10·1 answer
  • Consider the classes below: public class TestA { public static void main(String[] args) { ​ int x = 2; ​ int y = 20 ​ int counte
    6·1 answer
  • How many of you got the right answer from this app​
    8·1 answer
  • The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private fi
    6·1 answer
  • You are about to repair and change the resistor (small components),but the components are too small to solder and hold,what tool
    12·1 answer
  • Copying materials from a source text without using is<br> considered plagiarism<br> ?
    5·1 answer
  • Difference between software developer and software engineer.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!