Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Define a Java class. In this class, you should implement necessary methods to achieve the following
- functionality:
- (a) There is a list of numbers A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
- Create an array which capacity is sufficient to hold required data in the following pattern:
- A0+A15 || A1+A14 || A2+A13 || A3+A12 || A4+A11 || A5+A10 || A6+A9 || A7+A8
- A0=0
- A1=1
- A2=2
- A3=3
- A4=4
- A5=5
- A6=6
- A7=7
- A8=8
- A9=9
- A10=10
- A11=11
- A12=12
- A13=13
- A14=14
- A15=15
- Using an iterative structure to store the above data required into the array you had created.
- (b) Calculate the sum of the numbers that are divisible by 3 in the array above and print the sum.
- (c) Print the data with even index numbers from the above array.
- (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