Question
Use what we have learned about data types, variables, and operators to do some calculations and output the results of those calculations to the command
Use what we have learned about data types, variables, and operators to do some calculations and output the results of those calculations to the command line in text format.
Required Reading
Chapter 2 and lecture slides
You are expected to use only the material we have covered in the course so far. Even if you know of another way to solve this programming problem, please stick to the approach we are using in this class.
Learning Goals
Learn to work with
- data types
- variables
- operators for arithmetic and text
Scenario
Lily and Vern own a farm where they live and work. They grow lots of cucumbers. They have so many cucumbers that they are not able to eat or sell them all. So, they make pickles with some of the cucumbers. By pickling the cucumbers, they are able to turn their crop into a product that has a longer shelf life. Since pickles have a long shelf life, Lily and Vern can sell them during the winter. The money they make from selling pickles during the winter allows them to avoid dipping into savings.
Lily and Vern have raised an extra big crop of cucumbers this year. They need to be able to make bigger batches of pickles. They have asked for your help in calculating how many batches of pickles they will need to make in order to pickle all the cucumbers they have. Of course, the number of batches will depend on the size of the pickling pot, how many pickles there are, and how many cucumbers can be processed in each batch.
Setting Up the Variables
Use the digits from YOUR birth date to set up the variables for this project.
- Example birth date: November 17, 1993
Pot size is measured in gallons. Use the month of YOUR birth as the number of gallons the pickling pot will hold.
- For the example birth date provided above, the pickling pot would hold 11 gallons.
Use the year of YOUR birth multiplied by 7 for the number of cucumbers available for pickling. Use the program you will create to calculate this value and assign it to an appropriately typed and named variable.
- For the example birth date provided above, the number of pickles available for pickling would be 13,951.
Cucumbers come in a variety of sizes from very small to really big. Use the day of YOUR birth multiplied by 5 as the value for how many cucumbers will fit in a one-gallon pot. Use the program you will create to calculate this value and assign it to an appropriately typed and named variable.
- For the example birth date provided above, the number of cucumbers that would fit in one gallon would be 85.
Output each of the following to the command line on a separate line.
- Size of the pot
- Number of cucumbers
- Number of cucumbers that will fit in one gallon
- Number of cucumbers that can be processed in each batch as a decimal value
- Number of batches required to process all of the cucumbers as a decimal value
- A brief message to Lily and Vern explaining how you determined the number of batches that would be required to process all of the cucumbers.
In your source code
- Use comments to make note of helpful information that may be useful to other programmers or your future self
>>>> SUBMIT YOUR SOURCE CODE as a SINGLE FILE on D2L DROPBOX<<<<
Sample Output
The size of the pot is 11 gallons.
There are 13,951 cucumbers available for pickling.
85 cucumbers will fit in one gallon.
935.0 cucumbers can be processed in each batch.
14.920855614973 batches will be required to process all of the cucumbers.
Dear Lily and Vern,
I calculated the number of batches need to process all of the cucumbers by doing (insert whatever you did here).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started