Question: Given method called cube. Ask the user for a number, call the cube method and pass this number as a parameter. Write all required code

Given method called cube. Ask the user for a number, call the cube method and pass this number as a parameter. Write all required code inside cube method in order calculate the cube of a number.

Example:

input: 5

output: 125

hint: cube of a number n = n*n*n

-------------------------------------------------------

import java.util.*;

class Main { public static int cube(int n) { //your code here }//end cube public static void main(String[] args) { //Your code

System.out.println(cube(n)); } }

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!