Question: JAVA Instructions Table of Powers Create an application that displays a table of squares and cubes from 1 to the value entered by the user.

JAVA

Instructions

Table of Powers

Create an application that displays a table of squares and cubes from 1 to the value entered by the user.

Console

Welcome to the Squares and Cubes table

Enter an integer: 9

Number Squared Cubed

====== ======= =====

1 1 1

2 4 8

3 9 27

4 16 64

5 25 125

6 36 216

7 49 343

8 64 512

9 81 729

Continue? (y/n): y

Enter an integer: 3

Number Squared Cubed

====== ======= =====

1 1 1

2 4 8

3 9 27

Continue? (y/n): n

Specifications

The formulas for calculating squares and cubes are:

square = x * x cube = x * x * x

Assume that the user will enter a positive valid integer.

The application should continue only if the user enters y or Y to continue.

Input

An integer using a string prompt

Processing

Calculate the square and cube of all the whole numbers, starting with 1 until you reach the number entered by the user.

Output

Print Header

Create a table with one row for each whole starting with 1 and going to the number entered by the user. In each row print the whole number, the square, and the cube of the whole number.

Tab the output so it is easy to read

Offer user another chance to create a table or to exit

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!