Better with age

Assignment Help JAVA Programming
Reference no: EM13841561

Better with Age (Or Not)

You and your roommates, all at least 21 years of age, have gotten hooked brewing your own beer from kits. You've made quite a few batches, each from a different mix, so you now have an impres­sively varied range of flavors; summer cherry wheat, chocolate hazelnut lager, pepperoni pale ale, etc. You'd like to get through all the batches before your court-mandated AA meetings are set to begin. You can probably polish off a batch a day, but some batches are clearly better than others, and you can't decide in which order to drink them. Further complicating matters, each beer is aging, causing it's quality to change over time. Sometimes, like a good wine, this change is for the better. Other times, as in the case of the pepperoni pale ale, each day you wait makes it that much more likely to kill you. Of course, you're not willing to throw anything out, so you've got a little optimizin' to do.

To make things concrete, you have n batches of beer, which you'd like to drink over the next n days, one batch per day. Each batch i has an initial quality qi and a rate of change ri, indicating how much that quality changes each day. So if you drink beer i after d days, the value you'll get is qi + d. ri. Your goal is to maximize the sum of these values over all n beers. Keep in mind that ri may be negative for some i, but you still intend to consume all the beer in n days, even if the value for some beers is negative.

Give an algorithm to solve this problem, and prove it is correct.

Reference no: EM13841561

Questions Cloud

Evaluate laws and regulations relative to product safety : evaluate laws and regulations relative to product safety and liability
Net profits after taxes : Doris Wise is a young career woman. She lives in Phoenix, Arizona, where she owns and operates a highly successful modeling agency. Doris manages her modest but rapidly growing investment portfolio, made up mostly of high-grade common stocks. Because..
Describe models of cultural evolution and cultural ecology : Describe models of cultural evolution and cultural ecology
Describe the differences among generalized and balanced : Describe the differences among generalized and balanced
Better with age : You and your roommates, all at least 21 years of age, have gotten hooked brewing your own beer from kits. You've made quite a few batches, each from a different mix,
Are there any holes in your theory : Explain the topic you chose and why it is interesting or controversial. Present good arguments on more than one side of the issue (e.g. competing explanations of the facts). Analyze both arguments that you have presented. Then present your own arg..
Restate and critically exatnine astselms ontological : Restate and critically exatnine Astselm's ontological argument
Students will construct a well-diversified portfolio : Students will construct a well-diversified portfolio using an initial investment stake of $50,000 (the portfolio should use at least 95% of the initial investment, but they may not use more than $50,000). Students may include stocks, common or prefer..
Identifies the transitions between acts : Identifies the transitions between acts. Identifies and justifies elements of the hero's journey within the films. Describes how the use of the hero's journey was effective in the movie (or how it was not)

Reviews

Write a Review

JAVA Programming Questions & Answers

  Insert uml design diagrams, use case, classes

Insert UML design diagrams here (use case, class, and sequence diagram).

  Implementing the add and remove methods

Prepare a class that maintains the top 10 scores for a game application, implementing the add and remove methods but using a doubly linked list instead of an array. Program has to be written in java

  What could you do to kill more mutants

What are the implications related to suite of unit test cases when some mutants are not killed and What could you do to kill more mutants?

  Complete the code found in player.java

You are to complete the code found in Player.java. Once completed you can then simulate a good old game of Rock, Paper, Scissors. To play you need to compile Player.java, InputMaker.java, and RockPaperScissorsTest.java. Then you will run InputMake..

  Write an app that allows user to enter a seven-digit number

Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson's salary. The process repeats until the user finishes entering all employees' information

  Apply the bfs algorithm and show the output

Apply the BFS algorithm and show the output and Apply the DFS algorithm and show the output - Define the necessary functions to implement the search problem. This should include a function that takes a vertex as input and returns the set of vertice..

  Create a dice game that uses a six-sided die

Create a dice game that uses a six-sided die - Using switch statements print the face of the die based on the value obtained.

  A method that takes a two-dimensional array

A method that takes a two-dimensional array of int's as a parameter and searches the array for the second parameter, returning true if the second parameter matches any of the integers in the array, and false otherwise.

  Write an interface for an abstract method

Write an interface, PointingDevice, containing:  an abstract method, getXCoord that returns an int and an abstract method, getYCoord that returns an int.

  Build an android application to execute some of the queries

Build an android application to execute some of the queries -

  Write an application in which the user can enter a date

Write an application in which the user can enter a date using digits and slashes (for example, " 6/24/2012 " ), and receive output that displays the date with the month shown as a word

  Run the code

Run the following code, Explain the output aYer you let it run 20 seconds, 5 minutes, 10 minutes.

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