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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started