Question: please help with this program JAVA Create a BlueJ project named: LabActivityClassesAndObjects Class: Cylinder Add code from: Participation Activity - Class Declaration and Instance Variables

please help with this program JAVA

Create a BlueJ project named: LabActivityClassesAndObjects

Class: Cylinder

  • Add code from:
    • Participation Activity - Class Declaration and Instance Variables
    • Participation Activity - Constructors and Instance Methods
  • Add Instance Method: Set Units
    • Parameters: String
    • Return Type: void
  • Add Instance Method: Set Material
    • Parameters: String
    • Return Type: void
  • Add Instance Method: Set Height
    • Parameters: double
    • Return Type: void
  • Add Instance Method: Set Radius
    • Parameters: double
    • Return Type: void

Class: Lab Activity Classes And Objects

Main Method

  • Add declarations from Participation Activity - Using Constructors and Calling Instance Methods
  1. Create Comment: Display Initial Values Display a description and the volume of Pin Display a description and the volume of Dowel
  2. Create Comment: User Input Get user input for Pin Units Get user input for Pin Material Get user input for Pin Height Get user input for Pin Radius
  3. Create Comment: Modifying Object Call the appropriate instance method to update the values of the Pin
  4. Create Comment: Final Values Display a description and the volume of Pin Display a description and the volume of Dowel

I have done class Cylinder and the first part of the main class please take a look

class Cylinder

public class Cylinder { // VARIALBES private double radius; private double height; private String units; private String material; // CONSTRUCTORS public Cylinder() { radius = 1.0; height = 1.0; units = "inches"; material = "Aluminum"; } public Cylinder(double cylinderRadius, double cylinderHeight, String cylinderUnits, String cylinderMaterial) { radius = cylinderRadius; height = cylinderHeight; units = cylinderUnits; material = cylinderMaterial; }

//METHODS public double volume() { return(height * Math.PI * Math.pow(radius, 2)); } public void setUnits(String units) { units = units; }

and here is part of the main class

public class LabActivityClassesAndObjects { public static void main(String[] args) { // CONSTANTS // VARIABLES // ARRAYS // OBJECTS Cylinder pin = new Cylinder(); Cylinder dowel = new Cylinder(5, 40, "mm", "Oak"); // Initial Values System.out.println("Pin volume: " + pin.volume() + " mm^2"); System.out.println("Dowel volume: " + dowel.volume() + " mm^2");

I need these parts

  1. Create Comment: User Input Get user input for Pin Units Get user input for Pin Material Get user input for Pin Height Get user input for Pin Radius
  2. Create Comment: Modifying Object Call the appropriate instance method to update the values of the Pin
  3. Create Comment: Final Values Display a description and the volume of Pin Display a description and the volume of Dowel

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!