Question: Java programming question Create three classes to simulate cheese connoisseurs. One class representing the cheese (Cheese.java), one class representing the cheese connoisseurs (CheeseConnoisseur.java), and one

Java programming question

Java programming question Create three classes to simulate cheese connoisseurs. One class

representing the cheese (Cheese.java), one class representing the cheese connoisseurs (CheeseConnoisseur.java), andone class to run the simulation (Cheese Driver.java). Make sure to javadocyour code! There is no need for output for this program. Somerestrictions - No imports are allowed. - Make sure to not usethe following. var (the reserved keyword) System.exit Runtime.getRuntime.halt Runtime.getRuntime.exit Cheese.java File thatrepresents some cheese from a grocery store. Once a cheese has beentraded 3 times, it becomes sentient (becomes alive!). Instance Variables Pick appropriatevariable types and names. All fields should follow the rules of encapsulation.- Holds the type of the cheese (such as Pepperjack, Cheddar) -

Create three classes to simulate cheese connoisseurs. One class representing the cheese (Cheese.java), one class representing the cheese connoisseurs (CheeseConnoisseur.java), and one class to run the simulation (Cheese Driver.java). Make sure to javadoc your code! There is no need for output for this program. Some restrictions - No imports are allowed. - Make sure to not use the following. var (the reserved keyword) System.exit Runtime.getRuntime.halt Runtime.getRuntime.exit Cheese.java File that represents some cheese from a grocery store. Once a cheese has been traded 3 times, it becomes sentient (becomes alive!). Instance Variables Pick appropriate variable types and names. All fields should follow the rules of encapsulation. - Holds the type of the cheese (such as Pepperjack, Cheddar) - Holds the price of the cheese - Holds whether or not this cheese is sentient - Holds a counter of how many times this specific Cheese object has been traded. - Holds how many cheese trades have happened across all cheeses * This variable should be the same across all instances of Cheese Constructors - A constructor that takes in the price, type, and number of trades for that specific Cheese instance. * A cheese should not be sentient at instantiation unless it has already been traded 3 times. - A constructor that takes in price, type. * A cheese should not be sentient at instantiation. * By default, a Cheese object has been traded 0 times. Methods - A toString method that converts a Cheese object to a String * If the cheese is not sentient, the String should be: "This is a slice of type) cheese that has been traded (number of trades) times. * If the cheese is sentient, the String should be: I am a slice of type) cheese that has been traded (number of trades] times. - An equals method (as learned in class) dependent on type, price, and sentience. * We're looking for an overloaded equals method here, not an overridden Object equals method. - A method for when a cheese is traded * Increment the appropriate variables * A cheese is sentient if it has been traded at least 3 times. When cheese becomes sentient, it doubles in price. . When cheese becomes sentient, it should print "I'm ALIIIIIVE! - getters/setters as needed CheeseConnoisseur.java File that represents a cheese connoisseur who owns a singular cheese. Instance Variables Pick appropriate variable types and names. All fields should follow the rules of encapsulation. - Holds the name of the connoisseur. - Holds one cheese owned by the connoisseur. - Holds how much money the connoisseur has. Constructors - One constructor that takes in name, money, and cheese - One constructor that takes in name, money * Should give the connoisseur a null Cheese that can be filled later. * This should use constructor chaining. - One constructor taking name. * The connoisseur should have no money. * The connoisseur should have no cheese at the moment. * This should use constructor chaining. - One constructor with no arguments. * The connoisseur's name should be "Louis Pasteur" * The connoisseur should own no cheese at the moment. * The connoisseur should have $20.00 Methods - One method that allows a CheeseConnoisseur to make a trade. It will take in a Cheese object. * The connoisseur should replace their current cheese with the cheese that is passed in to the method. * Both cheese trade variables should increase by 1 (instance and object) * If a cheese has been traded 3 times, it should become sentient. - Another method that allows a CheeseConnoisseur to make a trade. It will take in a CheeseConnoisseur. This method should overload the previous method. * If one of the cheese connoisseurs has a null cheese, the trade will not happen. * If the two cheeses are equal, the connoisseurs do not trade Cheese objects. * If they are not equal, the connoisseur who gives away the less expensive cheese should pay the difference, then they trade cheese. If they do not have enough money to pay the difference, the connoisseurs will not trade Cheese objects. Both cheese trade variables should increase by 1 (instance and object). If a cheese has been traded 3 times, it should become sentient. - Getters/setters as needed Cheese Driver.java A driver file that will run the simulation. Make sure to have the following in your Cheese Driver: Create at least 4 Cheese objects Create at least 2 CheeseConnoisseur objects. - One of the CheeseConnoisseur should be initialized with no cheese Execute trades until at least 3 Cheese objects are sentient

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!