Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. Define a Java class. In this class, you should implement necessary methods to achieve the following
  2. functionality:
  3.  
  4. (a) There is a list of numbers A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
  5.  
  6. Create an array which capacity is sufficient to hold required data in the following pattern:
  7. A0+A15 || A1+A14 || A2+A13 || A3+A12 || A4+A11 || A5+A10 || A6+A9 || A7+A8
  8.  
  9. A0=0
  10. A1=1
  11. A2=2
  12. A3=3
  13. A4=4
  14. A5=5
  15. A6=6
  16. A7=7
  17. A8=8
  18. A9=9
  19. A10=10
  20. A11=11
  21. A12=12
  22. A13=13
  23. A14=14
  24. A15=15
  25.  
  26.  
  27. Using an iterative structure to store the above data required into the array you had created.
  28. (b) Calculate the sum of the numbers that are divisible by 3 in the array above and print the sum.
  29. (c) Print the data with even index numbers from the above array.
  30. (d) Reverse the sequence of the numbers in the array and print the resulted array.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement