Create a generic class called TriPrism. It shall store the dimensions of a triangular prism and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a generic class called TriPrism. It shall store the dimensions of a triangular prism and calculate its volume. The type of the dimensions will be decided upon instantiation of the TriPrism objects. Use the formula: volume = length * (0.5 * base * height) 1. Create a generic class called TriPism! 2. Declare three (3) private variables named length, base, and height. 3. Add three (3) pairs of getters and setters to retrieve and set the values of the variables mentioned above. 4. Create another class named TriPrismDemo. 5. In its main method, instantiate two (2) TriPrism objects named tp1 (Integer) and tp2 (Double). 6. Use the setter methods to set the values of the dimensions. 7. Calculate and display the volume of the two (2) TriPrism objects using the getter methods. Refer to the formula provided above. Sample Output: Triangular Prism 1 Length: 10 Base: 7 Height: 5 The volume of the triangular prism is 175.0. Triangular Prism 2 Length: 9.10 Base: 6.25 Height: 4.20 The volume of the triangular prism is 119.4375. Create a generic class called TriPrism. It shall store the dimensions of a triangular prism and calculate its volume. The type of the dimensions will be decided upon instantiation of the TriPrism objects. Use the formula: volume = length * (0.5 * base * height) 1. Create a generic class called TriPism! 2. Declare three (3) private variables named length, base, and height. 3. Add three (3) pairs of getters and setters to retrieve and set the values of the variables mentioned above. 4. Create another class named TriPrismDemo. 5. In its main method, instantiate two (2) TriPrism objects named tp1 (Integer) and tp2 (Double). 6. Use the setter methods to set the values of the dimensions. 7. Calculate and display the volume of the two (2) TriPrism objects using the getter methods. Refer to the formula provided above. Sample Output: Triangular Prism 1 Length: 10 Base: 7 Height: 5 The volume of the triangular prism is 175.0. Triangular Prism 2 Length: 9.10 Base: 6.25 Height: 4.20 The volume of the triangular prism is 119.4375.
Expert Answer:
Answer rating: 100% (QA)
Introducing the concept The task involves creating a generic Java class named TriPrism to represent a triangular prism and calculate its volume The class is designed to store dimensions length base an... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Suppose the 2017 adidas financial statements contain the following selected data (in millions). Compute the following values and provide a brief interpretation of each. (a) Working capital. (b)...
-
In Figure 11.8, (a) what is the level of full employment? How much is the rate of output reduced when (b) AD shifts leftward? (c) AS shifts leftward? (d) both AD and AS shift leftward? Figure 11.8...
-
Given the weekly demand data in Exhibit 12.25 illustrate the operation of a fixed-order-quantity inventory system with a reorder point of 75, an order quantity of 100, and a beginning inventory of...
-
A university pumps its water from wells located on campus. The falling water table has caused pumping costs to increase, the quantity of water available to decrease, and the quality of water to...
-
Financial Statements Circus City issued an 8%, 10-year $2,000,000 bond to build a monorail mass transit system. The city received $1,754,217 cash from the bond issuance on January 1, 2012. The bond...
-
Calculate the following for a 3 ft 4 ft window with the label to the right. The summer design conditions for peak cooling load are 70 and 60% RH inside; 90 and 90% outside; and a peak direct solar...
-
Aman and Juanita have $150,000 in their business bank account. You have calculated their warehouse stock and equipment to be valued at a total of $480,000. They want to take out a policy for...
-
Recall the model of Medieval Economy: MV = PYt Y = LL %3D ()" P+1 L = P L (a) Suppose L = 2, V = 1, A = 1, M = M = 6, 0 = 0.2 solve for steady state P,L and Y. (b) Suppose money supply increases, Mt...
-
On a highway curve with radius 60 m, the maximum force of static friction (centripetal force) that can act on a 1,123-kg car going around the curve is 8,327 N. What speed limit should be posted for...
-
Jane tells John "I offer to sell you my fish tank for $200 and I will leave the offer open until tomorrow at noon." Jane wants to revoke the offer later on that same day. Can she?
-
Tri-State Crematory: Funeral Service Law Please respond to at least one of your classmates. Your comment should be 150 words. I chose to respond to Bruce: This story finds us looking into a...
-
During her summing up, the judge says to the jury: "Your task is to decide whether the Crown has established beyond reasonable doubt all of the facts alleged. This is different to there not being any...
-
Are collective bargaining and labor unions consistent with biblical duties imposed on employees and employers? Is it merely another tool to keep sinful human behavior in check? How should a Christian...
-
First, salve the following IVP, y' = (15x + yy1. 15, y0)-1. Then calculate y(12).
-
An interesting puzzler for chess buffs is the Knights Tour problem, originally proposed by the mathematician Euler. Can the knight piece move around an empty chessboard and touch each of the 64...
-
a) Assume that the following method call is located in an overridden earnings method in a subclass: super.earnings() b) Assume that the following line of code appears before a method declaration:...
-
Suppose an image is displayed on a Canvas. One way to erase the image is simply to set every pixel to the same color immediately, but the visual effect is dull. Write an app that displays an image,...
-
Mega Tech, Inc. designs and manufactures automotive components. For years, the company enjoyed a stable marketplace, a small but loyal group of customers, and a relatively predictable environment....
-
Describe the features of a project. How do they differ from day-to-day processes within an organization?
-
In 2003, the Department of Health and Human Services in Victoria, Australia, initiated a AU$323 million project to develop HealthSMART, an integrated IT system that would deliver resource management,...
Study smarter with the SolutionInn App