Use appropriate instance varibles

Write a Java class called Table in a file called Table.java. You must allow a Table class object to store the shape of table (round, oval, rectangular), the number of legs, the base price per table, the surface area in square feet, and the wood. Use appropriate instance varibles for those. You can aID other data if you like. Make sure to provide appropriate access methods for your data. You must validate the data as:

  • Number of legs must be greater than or equal to one, and less than or equal to six
  • Shape can only be “round”, “oval”, or “rectangular”.
  • The surface area must be greater than or equql to 4 square feet, and less than or equal to 50 square feet
  • Base price must be greater than zero.
  • Wood can only be “oak”, “cherry”, “mahogany”, “pine”.
  • If you aID other instance variables, you must validate them with reasonable values. Justify those values in your comments.

Your table class must have a cost method that can be called to calculate and return a double with the final cost of the table. The final cost is the base price with an aIDitional cost calculated from the following function:

aIDitional$ = ft2 * wood$ + shape% * base

The wood$ (wood cost) per square foot is $1.00 for pine, $1.30 for oak, $1.60 for cherry, and $1.90 for mahogany. You may assume that these prices are constant and will never change. The shape% (percent aIDitional for special shapes) are 0% for rectangular, 20% for round, and 40% for oval. You may assume that these percentages will never change.

Thus, as an example, if the base price of a round, cherry table of 10 square feet is $100, then the final price should be $100 + 10 * 1.60 + 0.2 * 100 = $136.

Note: the figure at the end shows program operation with several input.

Order a similar paper and get 15% discount. Use the coupon code GILB

Dr. Padma Myers
Dr. Padma Myers
98% Success Rate
Read More
“Hello, I deliver nursing papers on time following instructions from the client. My primary goal is customer satisfaction. Welcome for plagiarism free papers”
Stern Frea
Stern Frea
98% Success Rate
Read More
Hi! I am an English Language and Literature graduate; I have written many academic essays, including argumentative essays, research papers, and literary analysis.
Dr. Ishid Elsa
Dr. Ishid Elsa
98% Success Rate
Read More
"Hi, count on me to deliver quality papers that meet your expectations. I write well researched papers in the fields of nursing and medicine".
Dr. Paul P. Klug
Dr. Paul P. Klug
99% Success Rate
Read More
"A top writer with proven reliability and experience. I have a 99% success rate, overall rating of 10. Hire me for quality custom written nursing papers. Thank you"

How Our Essay Writing Service Works

Tell Us Your Requirements

Fill out order details and instructions, then upload any files or additional materials if needed. Then, confirm your order by clicking “Place an Order.”

Make your payment

Your payment is processed by a secure system. We accept Mastercard, Visa, Amex, and Discover. We don’t share any informati.on with third parties

The Writing Process

You can communicate with your writer. Clarify or track order with our customer support team. Upload all the necessary files for the writer to use.

Download your paper

Check your paper on your client profile. If it meets your requirements, approve and download. If any changes are needed, request a revision to be done.

Recent Questions

Stay In Touch!

Leave your email and get discount promo codes and the best essay samples from our writers!