Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have finals coming up. (Tony Gaddis Starting out with Java) Given that Chapter

ID: 3831488 • Letter: I

Question

I have finals coming up.

(Tony Gaddis Starting out with Java)

Given that Chapter 6 was on classes.

Chapter 7 was on Arrays and the ArrayList Class.

We were told to know :

surface are and volume of a cylinder

Could you give me some pseudo code that uses Arrays, array list, incorporates Classes

I dont need any code, just ideas of what a test question would consist given those conditions!

Thanks!

we have covered

Decision Structure

loops

methods

classes , arrays and arraylist Heave emphasis on these....

last test we were to make methods to area of triangle and such

Thanks for all your help!

Explanation / Answer

Since you have to calculate surface area and volume of cylinder
then you can store many Cylinder information in ArrayList

Just create a Cylinder class:

   class Cylinder{
       double height;
       double radius;
   }

   Now, you can define calculateArea() and calculateVolume() methods inside Cylinder class:

       class Cylinder{
       double height;
       double radius;

       double calculateVolume(){
           //
       }

       double calculateArea(){
           //
       }
   }


   Now, you can create another class that interact with user to take Cylinder information:

   class Test{

       main(){

       // create ArrayList to store Cylinder Object
       ArrayList<Cylinder> list = new ArrayList<>();

       // Now you can have a while loop to take cylinder information about cylinder till user want

       while(//user condition to stop loop){

           // get information of a Cylinder

           create a object of Cylinder

           add this object in arraylist

           list.add(cylinder);
       }

       // now you can iterate array list and show area and volume of each Cylinder

       for(Cylinder c : list){
           c.calculateVolume();
           c.calculateArea()
       }

       }
   }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote