[JAVA] Create a Beverage Dispenser using the requirements shown in the following
ID: 3577850 • Letter: #
Question
[JAVA] Create a Beverage Dispenser using the requirements shown in the following video (https://www.youtube.com/watch?v=W1uALGByz3w&feature=youtu.be). Your design should use Object Oriented Programming and Collections (with generics) and serialization. Try to include condiment handling and paper cups in the dispenser. Your design will be complete if you use collections for coffee beans used for each cup of coffee, paper cups, condiments like sugar, splenda, cream, etc.
This is to be a simple GUI program using swing. A simple design is provided in the photo below:
Beans Dispense beverage Types Mix two type s Condiments Show Bev Dispensing Process Dispense Bev CJ s SizesExplanation / Answer
Answer:
Java provides a mechanism, called object serialization where an object can be described as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object.After a serialized object has been written into a file, it can be read from the file and deserialized that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.Most impressive is that the entire process is JVM independent, meaning an object can be serialized on one platform and deserialized on an entirely different platform.Classes ObjectInputStream and ObjectOutputStream are high-level streams that contain the methods for serializing and deserializing an object.The ObjectOutputStream class is used to serialize an Object. The following SerializeDemo program instantiates an Employee object and serializes it to a file.When the program is done executing, a file named employee.ser is created. The program does not generate any output, but study the code and try to determine what the program is doing.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.