100% Guaranteed Results


OOPJ – Java Question on Array Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

1. Write a Java program to create an array of size 10. Initialize the array by taking input from user.
2. Write a java program to create an array of size 10 and initialize the array at the time of declaration. Find sum of element of array.
3. Write a java program that create 2 arrays of same size. Find element wise addition of two array and store them in third array.
4. Write a program to reverse element of array without creating any temporary array.
5. Write a java program to find matrix multiplication of two array.
6. Write a java program to store the status of a room in a hotel. Status can be either filled (represented by 1) or vacant (represented by 0). Hotel contains 10 floor and each floor can have different no of room. Take input from user to fill the room status. Finally traverse the array and display total no of room, no. of room filled and no. of room vacant.
7. Write a java program to find maximum and minimum value in an array.
8. Write a java program to sort an array in ascending order.
9. Write a java program to search an element in an array.
10. Write a java program that will create a single array to store the information of passenger travelling in a bus. The information required is status of the seat i.e filled/ vacant. If filled name of the passenger and destination of the passenger. Design your program so that it required least amount of memory.
{Hint: Create array with higher dimension defined, lower dimension can be added later. }
11. Write a java program to find duplicate value in an array.
12. Write a java program to implement game of Sanke&Ladder by using 2D array. Layer 1 of the array contain 0,1 and 2. 0 means absence of both snake and ladder, 1 means snake is present at that index and 2 means ladder is present. In case layer 1 contain value 1 or value 2 then the penalty/reward will be present in layer 2 . Take 4 int variable to represent player1, player2, player3 and player 4 each of them will get turn one by one. Generate random number between 1-6 ( https://www.journaldev.com/515/random-number-generator-java ) and use that number as output of dice and change player location, check that location on matrix to see if it coincide with snake or ladder if yes change the player location by adding penalty/reward. Finally display the rank of player.
An example is shown below black layer is the board for the game. If cell value is 1 means snake is present and we need to move back the player. The value present in red layer give us the cell we need to move the player back, similarly 2 means ladder is present and we need to move the player forward by value present in red layer. You need to change player location to row and column patter to check for snake and ladder for example in below scenario each player start with location 0 i.e (0,0) . A player location 4 means 1st row 1st column, a location 7 means 2nd row 1st column

Reviews

There are no reviews yet.

Be the first to review “OOPJ – Java Question on Array Solved”

Your email address will not be published. Required fields are marked *

Related products