Question: Instructions package edu.buffalo.cis 4 2 5 . sp 2 4 . put - your - userid - here; / * * * File: Cube.java *

Instructions
package edu.buffalo.cis425.sp24.put-your-userid-here;
/**
* File: Cube.java
*
* Description: This class creates an instance of the Cube
* class and prints its area and volume.
*
* Requirements:
*1) Create 3 cube objects. The size of each of the cubes
* should be input from the keyboard
*(hint: study the code below)
*2) Print the Side length, Surface area and Volume to the
* user's screen (console) for each of the cubes
*3) The program should catch input error exceptions and
* deal with them in a reasonable manner
*
*/
/**
*
* @author put-your-name-here
*
*/
import java.util.Scanner;import java.io.*;
public class Cube {
// Hint: put your class variables and objects here
// For example the Scanner statement as a 'static' object
// Create the getLength() method to accept input and verify it is
// numeric and greater than zero
// Create the calculateSurfaceArea() method
// Create the calculateVolume() method
/**
* main()-- creates 3 instances of Cube and calculates the surface area and volume
*/
public static void main(String args[]) throws IOException {
int length;
// HINT: input the side from the keyboard and check for errors and exceptions
Cube cube1= new Cube(10);
System.out.println("Side length of cube1 is "+ cube1.getLength());
System.out.println("Surface Area of cube1 is "+ cube1.calculateSurfaceArea());
System.out.println("Volume of cube1 is "+ cube1.calculateVolume());
// Hint - add two more cube instances
// Don't forget to close your Scanner object
}// end main()
}// end Cube
When you have this Assignment ready for me to view and grade, you should upload your Cube.java file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question appears to request you to complete a Java programming task Heres a stepbystep breakdown ... View full answer

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!