Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please I need help with this urgently. Thank you. Question 1. Write a class that

ID: 3879460 • Letter: P

Question

Please I need help with this urgently. Thank you. Question 1. Write a class that has the following methods. Use nested for loops for all of these aray operations: public static void initialize (int( between min and max. a, int min, int max) : initialize the array by filling it with values um (int ( int( n b) : compute the sum of two arrays and return a new array with a, those values. Remember, each value in array a ge are the same size. ts added to the corresponding value in array b. Assume that the arrays public static void reverse (int) public static int copy(int[ a)create a new array that is a value-by-value copy of the argument array public static void printArray(int a) : print the values stored in the array a) reverse all the values in the array In your main() method prompt the user to enter two integers that will be the rows and columns for two arrays. Use your methods to initialize both arrays, to compute the sum and store it in a new array, to create a copy of one of your arrays and to reverse one of them. Print out your results as you go along. Sample output should appear on D2L before too long but get started!

Explanation / Answer

here is your code : ------------------->>>>>>>>>>>.

ArrayManipulation.java : ------------->>>>>>>>>>>>

import java.util.Scanner;
import java.util.Random;

class ArrayManipulation{
public static void initialize(int[][] a,int min,int max){
  for(int i = 0;i<a.length;i++){
   for(int j = 0;j<a[0].length;j++){
    a[i][j] = new Random().nextInt(max-min);
   }
  }
}

public static int[][] sum(int[][] a,int[][] b){
  int[][] c = new int[a.length][a[0].length];
  if(a.length == b.length && a[0].length == b[0].length){
   for(int i = 0;i<a.length;i++){
    for(int j = 0;j<a[0].length;j++){
     c[i][j] = a[i][j] + b[i][j];
    }
   }
  }

  return c;
}
public static int[][] copy(int[][] a){
  int[][] c = new int[a.length][a[0].length];
   for(int i = 0;i<a.length;i++){
    for(int j = 0;j<a[0].length;j++){
     c[i][j] = a[i][j];
    }
   }

  return c;
}
public static void printArray(int[][] a){
  for(int i = 0;i<a.length;i++){
   for(int j = 0;j<a[0].length;j++){
    System.out.print(" "+a[i][j]);
   }

   System.out.println("");
  }
}
public static void reverse(int[][] a){
  int temp;
  for(int i = 0;i<a.length;i++){
   for(int j = 0;j<a[0].length;j++){
    temp = a[i][j];
    a[i][j] = a[j][i];
    a[j][i] = temp;
   }
  }
}

public static void main(String[] args) {
  int[][] a,b,c;
  int r,col;
  Scanner sc = new Scanner(System.in);
  System.out.println("Enter the rows : ");
  r = sc.nextInt();
  System.out.println("Enter the cols : ");
  col = sc.nextInt();
  a = new int[r][col];
  b = new int[r][col];
  c = new int[r][col];
  initialize(a,30,50);
  initialize(b,1,56);
  c = sum(a,b);
  System.out.println("Array A : ");
  printArray(a);
  System.out.println("Array B : ");
  printArray(b);
  System.out.println("Array C : ");
  printArray(c);
}
}

Hero.java : -------------->>>>>>>>>>>>>

class Hero{
private String name;
private int health = 100;
private int max_items;
private List<String> items;

public Hero(String n,int max){
  max_items = max;
  name = n;
  items = new ArrayList<>();
}

public Hero(){
  max_items = 2;
  name = "Anonymous";
  items = new ArrayList<>();
}

public String inventory(){
  String s1 = "items : ";
  for(int i = 0;i<items.size();i++){
   s1 += ","+items.get(i);
  }
}

public void take(String item){
  if(items.size() == max_items){
   System.out.println("your Backpack Reach Maximum ");
  }else{
   items.add(item);
   System.out.println("Item added");
  }
}

public void drop(String item){
  if(items.remove(item)){
   System.out.println("Item Dropped");
  }else{
   System.out.println("Item is not present in your Back pack");
  }
}

public void takeDamage(int dam){
  health = health - dam;
  if(health < 0){
   health = 0;
  }
}

public void heal(int h){
  health = health + h;
  if(health > 100){
   health = 100;
  }
}

public String toString(){
  String s1 = "Name : "+name+"   Health : "+health+"   "+inventory();
  return s1;
}
}