Question: The single program must be created inside one and only one file titled exactly Shapes.java (without quotes) and have the following functionality: [Component 1] A
The single program must be created inside one and only one file titled exactly Shapes.java (without quotes) and have the following functionality:
- [Component 1] A graphical interactive component which has the following actions associated with it; the component can accept user input, where assuming the input is valid, a shape will be displayed on the main screen. It is assumed that the program will eventually support a large variety of shapes. The program should currently accept the following input: an integer between 3 and 6 inclusive. Depending on the input, the program should generate a shape with the number of sides corresponding to the input value. For example, an input of 4 should generate a shape with four sides.
- You need to ensure that the user input is validated, and feedback is given when invalid input is entered.
- The program should only allow the user to enter one valid input at a time.
- The main screen should only display one active shape at a time.
- The colour of the active shape should be grey if the number of sides is even, and blue if the number of sides is odd.
- [Component 2] A graphical interactive component which has the following actions associated with it; the component must accept user input, where assuming the input is valid, the currently displayed shape will be manipulated depending on the validated input. The program should currently accept the following inputs: decrease the number of sides of the current shape by 1, increase the number of sides of the current shape by 1.
- You need to ensure that the user input is validated, and feedback is given when invalid input is entered.
- The program should only allow the user to enter one valid input at a time.
- The active shape should always have at minimum, 3 sides, and at maximum, 6 sides in total.
- The colour of the active shape should be grey if the number of sides is even, and blue if the number of sides is odd.
- The currently displayed shape should only be filled with one colour at a time.
- Any potential error states should not crash the program or generate generic error messages. The program should clearly indicate to the user that an error has occurred, with specific information on why the error occurred and what valid action(s) are available.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
