Show how you would determine from within the hitwalker


1. Simplify the following

a)A && trueb)A || true
c)A || false
d)A && false

2. Convert to ORs using DeMorgan's Theorem

A && !B

3. Convert to ANDs using DeMorgan's Theorem

!(A||B||!C)

4. Simplify a&&(!b) || a&&b where a and b are boolean types.

5. In a boolean situation, what would be the opposite of the following expressions? Assume p is an integer type. USE ANATOMICALLY CORRECT JAVA SYNTAX.

a)(p > 9)
b)(r == 0)
c)(q >= s)

Use the following code in problems 6-9. Assume the Car class has already been created public class Tester
{
public static void main(StringI1 args)
{
double all= new double110001;
a121 = 19;
Car myCar = new Car(30); //sets mpg to 30 int tz = 46;
String s = "Pontotoc";
mcthodl(tz, a, myCar, s);
System.out.println (tz);
System.out.println(a121);
System.out.println(myCarempg);
Systenhout.println(s);
public static void methodl(int p, double glI, Car theCar, String str)
{
p = 800;
= -17.002;
thcCar.mpg = 25; str = "Field Creek";
}

6. What is printed by System.oraprintIn(tz); ?
7. What is printed by System.outprintln(aPp; ?
8. What is printed by System.omprintln(myCarmpg); ?
9. What is printed by System.outprintln(s); ?
10. Suppose the signature of a method is as follows:

private int bitWalker(int1111 x)
In the bit Valker method how would you determine how many rows are in the x army?
System.out.println( );

11. Using the signature from problem 7, show how you would determine from within the hitWalker
method how many columns are in this array. You may assume the array is perfectly rectangular and is not "ragged".

Systemout.println( );

12. Write code that will create a two dimensional array representing the following matrix. Use a for the object name.

12-20
-3472
6031

13. Using the array a[][] In you created in problem 9, what would be printed by the following code?

System.outprintln(a[2][1]);

14. What would be the result of running the following code?
int a[][] = new int[5][6];
a[1][2]=27;
a[1][3]=-11;
System.out.println(a[2][1]);

15. What is the effect of making a class abstract?

16. What is the effect of making a method abstract? Write the signature of abstract method anon4 that receives a two dimensional matrix and returns a boolean.

17. What is the effect of making a method final?

18. Name two ways you can make a method "invisible" to an inheriting class below it.

19. I create three objects from Vehicle, Car, Hybrid (in that order of hierarchy) named v1, c1, and h1 (respectively). What do the following statements print?

a)Systentout.println(v1 instanceof Car);
b)Systeni.out.println(h1 instanceof Car);
c)System.out.println(h1 instanceofIlybrid);
d)System.out.println(cl instanceof Vehicle);

20. Referring to the above, I create a method with the signature public void driveMe(Car temp).

a) Which of the following statements would be legal?

b) Fix any statements that are not legal

a) driveMe(v1);

b) driveMe(c1);

c) driveMe(h1);

21-24. Using pseudocode (i.e. it doesn't have to be legal JAVA), create three classes EnglishMusicians, RockBand, RollingStones. RockBand inherits EnglishMusicians, RollingStones inherit Rockband. For each one, create three method signatures (void, no parameters) that meet the following requirements:

a) One of EnglishMusicians' methods MUST be visible the whole way down the inheritance chain

b) A RollingStones object can use all three of its methods, two of Rockband's methods but only one of EnglishMusicians' methods.

25. Created two classes

public class Electron

{

public void charge1()
{

System.out.println("Charge1");

}

private void charge2()

{

System.out.println("Charge2");

}

public void charge3()

{

System.out.println("Charge3"),

}

}

public dass Quark extends Electron

{
public void charge3()

{

System.out.println("Flavor1");

}

public void charge4()

{

System.out.println("Flavor2");

}

public void charges()

{

System.out.println("Flavor3");

}

}

}

Explain what happens when I execute the folloing in a separate Tester class.

Electron sparky = new Quark();

sparky.charge2();

sparky.charge3();

sparky.charge5();

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Show how you would determine from within the hitwalker
Reference No:- TGS01062508

Expected delivery within 24 Hours