Question: Current Code: public class Banker { public static MONEY_VALUES(){ } } public class GameControl { } Banker class formula: Formula The bankers cash offer depends

Current Code:

public class Banker { public static MONEY_VALUES(){ } }

public class GameControl { }

Current Code: public class Banker { public static MONEY_VALUES(){ } } public

class GameControl { } Banker class formula: Formula The bankers cash offer

Banker class formula:

Formula The bankers cash offer depends on the serial number of the current round and on the average of the contents of the non-eliminated briefcases. The formula used in a real life game is not public. In this model you have the following formula to apply:

N is the serial number of the round currently finished in the game (0

avg is the average of the dollar values in the remaining briefcases

temp = 0.01 *(75 + 5 * N 3 * max(0, N -5)) * avg*(1+0.15*(avg-55000)/Math.abs(avg 55000))

offer=Math.max(100,1000*Math.round(temp/1000))

Banker This class represents the banker. The banker knows the set of dollar values used in the game. The banker's only responsibility is to make offers to encourage the player to quit the game Fields MONEY VALUES Array of the dollar values, public static and constant, holds all the dollar values used in the game. Initialized at the declaration by an initializer list of values Methods makeOffer() static method. Takes two parameters: an int type for the serial number of the current round and a double value for the average of the dollar values in the remaining cases. The method computes and returns the offer to be made by the banker. The calculation is described above in the Formula section if Analysis Game Control This class controls game play. All methods exceptplay() are helper methods as such those must be declared private. Fields to hold a BriefcaseCollection object, instantiate it at declaration using the collection MONEY VALUES array from the Banker class for parameter Scanner object applied for obtaining input from the user to direct game play kb instantiate at declaration Methods choose ACase() Takes a BriefcaseCollection object collection for parameter and returns one of the briefcases from collection; the method l. calls showRemainingCases() w.r.t collection to display the serial numbers of the remaining briefcases 2. solicits a choice by the player from displayed serial numbers 3. saves the selected input in a local variable 4. runs a while loop to validate the input from the console (control the loop with the return value ofthe invalidChoice() method) 5. if input accepted, the choose ThisCase() method with the solicited number as parameter is called and the value is returned The double type parameter will be used for the banker's offer, the method make Deal() l. opens a confirm dialog (see Figure l below) to display the offer 2. The user clicks Yes to accept and No to reject the deal 3. Checks if the answer is equal to JOptionPane.YES OPTION and the boolean result is returned

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!