Any help, I can't seem to get the part where I store the weight of each snake, then get the total weight and make sure the carryon weight is great than the snake weight.
Expand|Select|Wrap|Line Numbers
- public class SnakesonPlane
- {
- public static void main(String[] args)
- {
- int[] a = {1, 7, 8, 7, 13};
- int snakeweight = 6;
- int carryonweight;
- int totalsnake = 20;
- int totalcarryon;
- for (int counter = 1; counter < a.length; counter++)
- System.out.printf("The number of snakes in element%2d is%3d \n",counter, a[counter]);
- if (counter == 1)
- {
- snakeweight = 550;
- if (counter == 2)
- {
- snakeweight = 15;
- if (counter == 3)
- {
- snakeweight = 12;
- if (counter == 4)
- {
- snakeweight = 10;
- if (counter == 5)
- {
- snakeweight = 23;
- for (int counter = 1; counter < a.length; counter++)
- {
- totalsnake = counter*snakeweight;
- System.out.println("You will need some pieces of carry-on luggage to block the snakes!");
- }
- }}}}}}}