Question: ** THIS IS IN JAVA** I need someone to set up a buffer class for me using the following Person class. This class should represent
** THIS IS IN JAVA**
I need someone to set up a buffer class for me using the following Person class.
This class should represent 1 person object with a get and set method.
Person.java
public class Person { private String name; private int age;
public Person() { name = ""; age = 0; } public Person(String s, int i) { name = new String(s); age = i; }
public Person(Person p) { this.name = p.name; this.age = p.age; }
public String getName() { return name; } public int getAge() { return age; } public void setAge(int a) { age = a; } public void setName(String n) { name = n; } public String toString() { return ("Name: " + name + " Age: " + age); } }
The buffer class should represent a Person object using a put and get method. The goal of the assignment is to illustrate the producer/consumer problem by setting up two threads that use a shared buffer. Use Threads and/or Runnable objects. Do not use synchronized, wait, notifyAll or a boolean to control access to the shared buffer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
