Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the java code in simplest way possible for E4.23 and include the output. E4.23 Implement a class SodaCan whose constructor receives the height

Please write the java code in simplest way possible for E4.23 and include the output.

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

E4.23 Implement a class SodaCan whose constructor receives the height and diameter of the soda can. Supply methods getVolume and getSurfaceArea. The E4_23 class has main method that prompts the user for height and diameter as an array and prints the computed Volume and Area. You must include documentation for your code defined in Appendix B. Example: Enter Soda Can's height and diameter, use space to separate elements: 5.0 3.0 Soda Can Volume: 35.34 Soda Can Area: 61.26 Hint: The java.util.Scanner class has a split() method to split the string. APPENDIX A Hint: P8.1 (comboLock) So the lock looks like this (it's from the textbook)]. As you can see the number goes up when turning left (counterclockwise) and when you hit 40, it's 0 again (40 is 0, 41 is 1, etc.); it goes down when turning right (clockwise) and when you hit -1, it's 39 again) pixhook/iStockphoto. And here's an illustration for opening a lock with combination 10, 15, 30. The secret numbers are in red; the user input of ticks are in blue. For simplicity, you can assume the user will always follow the order of turning (right-left- right). You don't need to check if the order is correct. initial 1st turn right Reading 0 30 0 30 10 10 20 20 After 30 ticks to right 2nd turn left 10 10 oz 10 o 20 o 30 OE After 5 ticks to left 3rd turn right 10 07 15 20 0 30 After 25 ticks to right 30 30 20 0 10 Hope this helps. Enjoy coding APPENDIX B Documentation and Javadoc Requirements 1. In every Java Application and class you should have enough header comments that will describe which assignment this is and who wrote the program. Thus, after any needed import statements your at the top under any imports statements you should put your program wide comments. 2. At the beginning of each method such as main(), you should have a short sentence describing the purpose of that method. Javadoc comments are always enclosed in /** and */ otherwise the Javadoc compiler will not find them. 3. As you get into programs with subordinate classes, you need to have header comments and again comments for each method. 4. Optionally, the @see comment is used to provide a links to other documents such as the original specification, the Java API for specific features, etc. For example, I may use the substring command in my code and I want to provide the reader with a link to the Java API: @see Java Substring method 5. Within a method you will need to put regular comments that are not caught by the Javadoc compiler but are useful in informing the reader on what is going on in this program. These comments are just preceded by two slashes: The purpose of the function is to accept a floating point number representing degrees Celsius and convert it into a floating point number representing degrees Fahrenheit. public float getF(float degC) { // declare variables float degF; // convert degrees C to degrees F degF - (degC * 1.8) + 32; return degF; } 6. Add Javadoc comments for EACH method in your class. Make sure that each method has an @param and @return Javadoc comment if they have parameters or return values. To get IntelliJ to make a template for you automatically, position your cursor above the method and type in /** then press enter. IntelliJ will build the template for your to fill in

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

What did they do? What did they say?

Answered: 1 week ago