Zigzac Fashion: 1174392

Introduction:

In this project I made a finch robot which will move in zigzac fashion. This program takes length of each zig zag section and number of zigzac section. It generates the speed automatically.

The finch stop for one second, turn orthogonally to the path travelled and start moving in the new direction for the length of the second zigzag line. As it is traversing the second section, the LED changes to blue. At the third section, it change its LED back to green. In the fourth section, the finch should go back to blue, and so on.

Once the finch complete traversing the given number of zigzag sections, it turns back and retrace its movements until it reaches the original starting position maintaining the same LED colour as when it first traversed each section. When the finch robot reaches the Initial starting position,

This program is implemented using a Graphical User interface and console. It uses java technology and specifically extends the functionality of Jpanel.

Program Functionality

  1. Input Validation

Implemented all the validation and displayed all necessary messages to the use if needed like below.

boolean isValid = false;

if (NUMBER_OF_ZIGZAC_SECTION % 2 != 0) {

isValid = false;

System.out.println(“Number of zigzac section can not be odd”);

}

if (NUMBER_OF_ZIGZAC_SECTION > 12) {

isValid = false;

System.out.println(“Number of zigzac section can not be more than 12”);

}

if (LENGTH_OF_ZIGZAC_SECTION < 2 * 38) {

isValid = false;

System.out.println(“Length of zic zac section should be atleast 2 cm”);

}

if (LENGTH_OF_ZIGZAC_SECTION > 85 * 38) {

isValid = false;

System.out.println(“Length of zic zac section should not be more than 85 cm”);

}

// PublishResults.writeUsingOutputStream(“a”);

return isValid;

Below is the screen shot in case of validation failure

  • Input Sequence from console

It takes length of each zig zag section and number of zigzac section and once complate the zic zac motion asks to continue or not as shown in below