Create package call beta and create class called testaccess


Problem

Create a new project and make sure your package explorer is visible.

Create a package called alpha and create a class called Access. In this class create default, public, protected private integers called intDefault, intPublic, intProtected, intPrivate.

Create a package called beta and create a class called TestAccess. TestAccess should extend Access. Create a method called printMessage(). In this method call System.out.println("intDefault = "+intDefault) and do this for each other type in the Access base class.

If this doesn't compile, then what can you do to change the code so it will?

You need to get this to work in main(). (The main method should be made in MainTestAccess.java)
Once you are able to make it work, make a new class in the alpha package called MainInAlpha.java.

Add the following code into it:

public static void main(String[] args){
TestAccess ta = new TestAccess();
int[] myArray = {100,200,300,400,500};
int theIndex = ta.foundNumber(myArray,200);
System.out.println(theIndex);
}

(Canvas is not the best with copying and pasting code, so you might need to type it)

Now go back into Access.java and add the following:

Make a method called foundNumber. This will take 2 parameters/arguments, an int array and a number to find in the array. This method will return the index where the number was found in the array. If the number cannot be found, return -1.
Examples:
foundNumber( {1,2,3,4,5}, 2) should return 1 since 2 is in index spot 1
foundNumber( {10,11,12,9}, 9) should return 3 since 9 is in index spot 3
foundNumber( {100,101,99,91,1}, 80) should return -1 since 80 is not in the array anywhere
Look at the solution Access.java and TestAccess.java

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create package call beta and create class called testaccess
Reference No:- TGS03340822

Expected delivery within 24 Hours