Question: Write a Java class called Chair.The Chair class has two private fields: double cost; String material; Create a constructor for this class: Chair(double cost, String
Write a Java class called Chair.The Chair class has two private fields: double cost; String material; Create a constructor for this class: Chair(double cost, String material) Create get and set methods for each field: void setCost(double cost) void setMaterial(String material) double getCost() double getMaterial()
Copy and paste this program to test your Chair class
public ChairDemo { public static void main(String[] args) { Chair myChair = new Chair(25.00, "Iron"); myChair.setCost(35.00); myChair.setMaterial("Gold"); System.out.println("My chair cost " + myChair.getCost()); System.out.println("My chair is made of " + myChair.getMaterial()); } } Create a UML file for the Chair class. (This can be ".txt" or ".docx" or ".pdf") Submit Chair.java and Chair.UML for this assignment.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
