Complete a Java program which calculates area of a square or rectangle. The program continues to ask
Question:
Complete a Java program which calculates area of a square or rectangle. The program continues to ask its user to choose an action among 1, 2 or 9.
If a user chooses 1 for action, the program will prompt for the width of the square and calculate the area of it.
If a user chooses 2 for action, the program will prompt for the width and height of the rectangle and calculate the area of it.
If a user chooses 9 for action, the program will terminate.
If a user inputs other integer as an action, the program will show "Invalid action."
Below is the sample screen output of the program. Those in bold and underlined are user inputs.
Choose shape (1:square, 2:rectangle, 9:exit):7
Invalid action.
Choose shape (1:square, 2:rectangle, 9:exit):1
Enter width:15
area of the square = 15 x 15 = 225
Choose shape (1:square, 2:rectangle, 9:exit):2
Enter width:26
Enter height:10
area of the rectangle = 26 x 10 = 260
Choose shape (1:square, 2:rectangle, 9:exit):9
Bye!
Write the missing statement segments (i) to (vi) ONLY of the following program
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill