On October 23rd, 2014, we updated our
By continuing to use LinkedIn’s SlideShare service, you agree to the revised terms, so please take a few minutes to review them.
CIS/355 iLab 3 of 6STEP 1: Cylinder (20 points)Create a class called Cylinder.java that contains two double-precision instance variablesnamed radius and height. The class should include a constructor that initializes the radius and heightvariables. Also, you need a class method named volume() that returns the volume of a Cylinderobject. The volume of a cylinder is given by its radius squared times its height times Pi (radius *radius * height * Math.PI). You can either use the value 3.1416 for Pi or use the Java providedvalue named Math.PI.Write a class called CylinderTest.java and declare an array of three Cylinder objects to call themethods you declared in the Cylinder class. Make sure that all class methods are called from main().Have main() display the value returned by volume() and verify the returned value by handcalculations (paper/pencil). Prompt the user to enter the values for the radius and height of eachCylinder object in the array.Grading Rubric Cylinder Points Description Must contain programs name, student name, andStandard header included 1 description of the programProgram compiles 2 Program does not have any errorProgram executes 2 Program runs without any errorCreated Cylinder class 3 Program contains the Cylinder classConstructor created that initializes A constructor method exists in the Cylinder class 2variables and initializes radius and height The volume method exists in the Cylinder class andContains a volume method 2 it returns the volume of a Cylinder objectCylinderTest class, which drives 4 A driver class with the main methodthe application, is created Program displays the radius, height, and volumeCorrect output is displayed 4 of three Cylinder objects Subtotal 20STEP 2: Date (20 points)
Create a program called Date.java to perform error-checking on the initial values, for instance:fields month, day, and year. Also, provide a method nextDay() to increment the day by one. TheDate object should always remain in a consistent state.Write a program called DateTest.java that prompts the user to enter the month, day, and year asnumeric values. This program then creates a Date object using the Date class you just created andtests the nextDay() method. This can be done in a loop of 40 iterations: the Date object calls thenextDay() method and prints the date during each iteration of the loop. This loop is to illustrate thatthe nextDay() method works correctly. Test the following cases: 1. Incrementing into the next month, for example, use date: 02/28/2011 2. Incrementing into the next year, for example, use date: 11/27/2011 3. Incrementing into the next month in a leap year, for example, use date: 02/28/2012Sample Program Output:Checking incrementDate object constructor for date 11/27/2011Incremented Date:11/28/2011Incremented Date:11/29/2011Incremented Date:11/30/2011Day 31 invalid. Set to day 1.Incremented Date:12/1/2011Incremented Date:12/2/2011...Incremented Date:12/30/2011Incremented Date:12/31/2011Day 32 invalid. Set to day 1.Incremented Date:1/1/2012Incremented Date:1/2/2012Incremented Date:1/3/2012Incremented Date:1/4/2012Incremented Date:1/5/2012Incremented Date:1/6/2012Grading Rubric Date Points Description Must contain program’s name, student name, andStandard header included 1 description of the programProgram compiles 2 Program does not have any errorProgram executes 2 Program runs without any error Date class has nextDay method and does not use anyCreated Date class 6 other predefined Java class for dateDateTest class, which drives the 4 User enters the values for month, day, and year in a
application, is created numeric format and test the nextDay methodCorrect output is displayed 5 The correct date increment is displayed Subtotal 20CLICK HERE TO GET THE SOLUTION !!!!!!!!!!