In this question you are required to define a class named Cylinder that contain the following:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this question you are required to define a class named Cylinder that contain the following: • Private instance variables radius and height. • Default constructor and constructor that takes two arguments radius, and height to initialize the instance variables. • A public getter and setter method for radius and height. • Public methods computeArea to calculate and return the area of the base ( area = n * radius² ) (use Math class where appropriate ) • Public method getVolume that calculate and return the volume (area = π * radius² ) * height). Please volume of the cylinder is 3.14 * radius *radius* height • Define toString() and equals() method in the Cylinder class also 1. Write the code for the class Cylinder as described. 2. Write a tester class main method that creates a Cylinder object using radius and height values entered by the user, then display area and volume of the cylinder with a precision of two digits after the decimal point. 3. Create an array of ten cylinder objects. After creating this array, use a lop to print all ten elements. 4. Create another two Cylinder objects and call the equals method and display its result. In this question you are required to define a class named Cylinder that contain the following: • Private instance variables radius and height. • Default constructor and constructor that takes two arguments radius, and height to initialize the instance variables. • A public getter and setter method for radius and height. • Public methods computeArea to calculate and return the area of the base ( area = n * radius² ) (use Math class where appropriate ) • Public method getVolume that calculate and return the volume (area = π * radius² ) * height). Please volume of the cylinder is 3.14 * radius *radius* height • Define toString() and equals() method in the Cylinder class also 1. Write the code for the class Cylinder as described. 2. Write a tester class main method that creates a Cylinder object using radius and height values entered by the user, then display area and volume of the cylinder with a precision of two digits after the decimal point. 3. Create an array of ten cylinder objects. After creating this array, use a lop to print all ten elements. 4. Create another two Cylinder objects and call the equals method and display its result.
Expert Answer:
Answer rating: 100% (QA)
Cylinderjava public class Cylinder instance variables private int radius private int height default constructor that initialize radius and height to d... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Garth is married to Hana, a native and citizen of Norway. Garth is a U.S. citizen. They live in New York City. He owns a life insurance policy on his life. The latest statement from the life...
-
6. Consider the linear system 3x1 +52 = 3 3x1 + 4x2 = 4 2x1 +32=5 (a) Find the projection b, of the vector of the right hand sides to the column space of the coefficient matrix. (b) Compute the...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Estimate the moment of inertia of a bicycle wheel.
-
A bond that pays interest forever and has no maturity date is a perpetual bond, also called a perpetuity or a consol. In what respect is a perpetual bond similar to (1) a nogrowth common stock and...
-
A 750-L rigid tank, shown in Fig. P6.122, initially contains water at 250C, 50% liquid and 50% vapor, by volume. A valve at the bottom of the tank is opened, and liquid is slowly withdrawn. Heat...
-
In some people, the bones of the middle ear stiffen with age. This can result in deafness. Why?
-
The Mighty Power Tool Company has the following accounts on its books: The firm extends credit on terms of 1/15, net 30. Develop an aging schedule using 15-day increments through 60 days, and then...
-
From How to Invest in Stocks: A Beginner's Guide: The article notes when choosing a brokerage you should consider what ?
-
You have been assigned the task of putting together a statement for the ACME Company that shows its expected inflows and outflows of cash over the months of July 2013 through December 2013. You have...
-
The standard deviations of Stock (K) and Stock (L) are 10% and 40%, respectively. The correlation between these two stocks is 54%. What is the APPROXIMATE standard deviation of a portfolio if we...
-
What is the output of the following code: int num = 10; double temp = 4.5; bool found; found = (num == 2* static_cast (temp + 1)); cout < < "The value of found is : " < < found;
-
Discuss the relationship between the 3 multilevel systems of organizational learning. What should organizations do to facilitate learning at each level?
-
What are examples of forensic document examination comparisons?
-
Last year Katie purchased a 9% corporate bond for its par value of $1,000. This year Katie received coupon payments totaling $90. What is the tax consequence for Katie this year, and what is her cost...
-
Sheddon Industries produces two products. The products' identified costs are as follows: Product A Product B Direct materials $ 19,000 $ 14,000 Direct labor 17,000 23,000 The company's overhead costs...
-
A Corporation owns 10 percent of D Corporation. D Corporation earns a total of $200.4 million before taxes in the current year, pays corporate tax on this income, and distributes the remainder...
-
The senior management at Davis Watercraft would like to determine if it is possible to improve firm profitability by changing their existing product mix. Currently, the product mix is determined by...
-
Write a program that demonstrates type casting of double values by performing the following tasks: Use Scanner to read a floating-point value x. Type cast x to an int value and store the result in y....
-
Suppose we would like to create a data structure for holding numbers that can be accessed either in the order that they were added or in sorted order. We need nodes having two references. If you...
-
Repeat the previous programming project, but read the input data from a file and send the output to another file. If you have covered binary files, use binary files; otherwise, use text files. Read...
-
Some FIR filters present a rational transfer function: (a) Show that the transfer function \[H(z)=\frac{\left(r^{-1} z ight)^{-(M+1)}-1}{r e^{\mathrm{j} 2 \pi /(M+1)} z^{-1}-1}\] corresponds to an...
-
Design second-order lowpass and highpass blocks, and combine them in cascade, to form a bandpass filter with passband \(0.3 \leq \omega \leq 0.4\), where \(\omega_{\mathrm{s}}=1\). Plot the resulting...
-
For the comb filter of Figure 4.31, choose \(L=10\) and compute the magnitude and phase responses for the cases where \(a=0, a=0.6\), and \(a=0.8\). Comment on the result. x(n) + Fig. 4.31....
Study smarter with the SolutionInn App