Use appropriate instance varibles

Assignment Help Biology
Reference no: EM13875777

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 add 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 add 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 additional cost calculated from the following function:

additional$ = 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 additional 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.

Reference no: EM13875777

Questions Cloud

Effective deterrent to unethical business practices : The FCPA has too many exceptions to be an effective deterrent to unethical business practices.Do you agree or disagree with this statement?
Point of application on plate : The point of application on the plate of the smallest force F that is equivalent to the given system, The magnitude and direction of F.
Operating system overview : Conducting independent research, please write a 2-3 page paper providing an overview of operating systems.  In particular, indentify the role of an operating system, methods common to all standard operating systems, and a list of common or most popul..
The federal sentencing guidelines : 1.What issues prompted the revision of the Federal Sentencing Guidelines for Organizations in 2004?
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 ..
Hash table contains tablesize positions : If a hash table contains tablesize positions and n records currently occupy the table, the load factor lf is defined as n/tablesize. Suppose a hash function uniformly distributes n keys over the tablesize positions of the table and lf is the load fac..
Ceos and cfos sign off on their company accounts : Do you think the requirement that CEOs and CFOs sign off on their company accounts will increase investor confidence in those accounts? Why or why not?
Mass moment of inertia of the plate : A thin semicircular plate has a radius a and a mass m. Determine the mass moment of inertia of the plate with respect to
What are four types of sbus and what are the goals of each : Name two types of organizational design and explain how they differ. What are four types of SBUs, and what are the goals of each?

Reviews

Write a Review

 

Biology Questions & Answers

  Patients who are homozygous for defective gene for enzyme

in 1990, the first human gene therapy experiment on a patient with adenosine deaminase deficiency was done. Patients who are homozygous for a defective gene for this enzyme have defective immune systems and risk death from diseases as simple as a ..

  Find the ratio observed across all traits

State which genes are dominant genes that get expressed over the other genes and which genes are recessive the genes that will not be expressed when the dominant gene is present.

  Prevention to keep our heart and circulatory system healthy

Our heart pumping and our circulatory system keep us alive. Many things like poor diet, lack of exercise, drinking and drugs damage our systems, even to the point of early death.

  Eating ants and termites demonstrates this predictability

The phennomenon of evolutionary convergence provides someindirect evidence that process of evolution is to some degreepredictable despite highly contingent nature. Explain how what you have learned about eating ants and termites demonstrates this ..

  What is the chemical reaction that formed these molecules

The molecule below is a disaccharide made from monomers of simple sugars. Both molecules were synthesized suing a common chemical reaction. What is the chemical reaction that formed these molecules and what is the common by-product of both these r..

  What other factors might limit the deer population

Thelarge white-tailed deer population in a forest reserve in Ontariohas caused concern about overgrazing that might lead to theextinction of plant and animal species found there.

  Geneticists compare dna base sequences among organisms and

geneticists compare dna base sequences among organisms and from this data determine a genes rate of evolution.

  How is flow of blood in circulatory systems regulated

How is flow of blood in circulatory systems regulated?

  Sequence were changed to uracil

If all of the guaninemolecules (g) visible in this mRNA sequence were changed to uracil(u), how would the translated protein differ from the one shown?

  Question 1 a list two benefits to sexual reproduction b

question 1 a list two benefits to sexual reproduction. b list two benefits to asexual reproduction. c explain what

  Is the secretion of epinephrine an example of endocrine

Is the secretion of epinephrine an example of endocrine, exocrine, paracrine, neuronal, or contact-dependent signaling?

  Bombardment prior to the formation of the lunar maria

How does your individual TRC and those of the average of class compare with the average TRC of the general population as reported by Holt (1968) as 145 for male and 126 for female.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd