Create additional methods to select the random items

Assignment Help Basic Computer Science
Reference no: EM131608865

Question: Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week. For this 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 three instance variables of type String. Add an appropriate constructor, accessor, and mutator methods. Also write a to String () method that returns as a String the complete contents of the box. Next, write a main method 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 method 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. If you create additional methods to select the random items and to select valid substitutions, then your main method will be simpler to write.

Reference no: EM131608865

Questions Cloud

Calculate the market to book ratio-price earnings ratio : What is Roxie's Bed & Breakfast's book value per share? Calculate the market-to-book ratio. Calculate the price-earnings ratio
How is conflict related to power : How is conflict related to power? What behaviors escalate a conflict (make it worse), and what behaviors deescalate a conflict
Is there a difference between price and value : Is there a difference between price and value? Why or why not? How do rectify the similarities or differences in relation to the behavior of the stock
Case analysis covering dispute issues : Provide a case analysis covering Dispute issues (such as meditation), business associations or securities issues surrounding the company Apple.
Create additional methods to select the random items : Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week.
Improve your organizations communication : Provide an assessment of the conditions, channels, and strategies used by your organization -improve your organizations communication
What tools can be used for financial statement analysis : What tools can be used for financial statement analysis? What kinds of business decisions can be made using these tools?
Compare and contrast the types of supervision : Compare and contrast the types of supervision- Theory X and Y and free-rein leadership. Which is better for the department as a whole?
Determinants of interest rate for individual securities : Determinants of Interest Rate for Individual Securities You are considering an investment in 30-year bonds issued by a corporation.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Create a controller fsm and connect it to the data path

Use the earlier test bench to simulate the controller/data path system to verify correct behavior.

  Write a program that creates two vectors from x-one

write a program that creates two vectors from x-one (call it P) that contains the positive elements of x, and a second (call it N) that contains the negative elements of x. In both P and N, the elements are in the same order as in x.

  What level of confidence did the pollsters use

The article adds that the poll is based on a random sample of 972 adults and has a margin of error of 2.5%. What level of confidence did the pollsters use?

  Company benefit from the globalization of production

1. What is globalization of production, and how might a company benefit from the globalization of production?

  Run for a fixed amount of times

What is the method called when you want a code to run for a fixed amount of times?

  Large risk for loss of personal data

What characteristics of Facebook or similar social media sites make it a large risk for loss of personal data.

  Find the difference in arts patronage from 1982 to 1992

Which areas saw the greatest increase and decrease in this time?. Which areas saw the greatest increase and decrease in this time?

  How many bits are used to represent unicode and ascii

How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters? What is the difference between yielding and sleeping?

  Recursive function to print the arrangements

Warm-up Assignment You are given R red marbles and B blue marbles. Your task is to arrange the R + B marbles in a line such that certain restrictions are satisfied (see below).

  Describe the conceptual model of a two-dimensional array

Describe the conceptual model of a two-dimensional array. Include in your explanation how a two-dimensional array might be used, why these arrays are similar to tables, and how to declare and initialize a two-dimensional array.

  What are some business uses for inserting a canvas

Write a response that answers the following: What are some business uses for inserting a canvas in a Microsoft® Word document. From these uses, propose a strategy that may help users overcome formatting issues.

  Check whether oldfd is valid

In this case, you should check whether oldfd is valid, which can be done by, for example, checking if fcntl(oldfd, F_GETFL) succeeds. If oldfd is not valid, then the function should return -1 with errno set to EBADF.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd