working on a java discussion question

Learning Goal: I’m working on a java discussion question and need an explanation and answer to help me learn.Question 1: True/false: A is an abstract class and B is an interface. C is a concrete class that extends A and implements B. Each correct answer is worth 1.5 points.
A reference variable of class A can reference an object of class C.
Answer:
The interface name B cannot be used to declare an object reference variable of class C.
Answer:
Class C needs to implement all abstract instance methods defined in B.
Answer:
Class A needs to have at least one abstract method.
Answer:
We can’t instantiate an object of class A
Answer:
Class C inherits all fields from A even though they are private.
Answer:Question 2 : A is an abstract class. B is a concrete class that extends A. C extends B and has a default constructor. At least how many reference types that we can use to reference an object of type C? ClassName variable_name = new C();i.e. what can ClassName be? Show all of them and explain.Question 3 : We are implementing an immutable class Polygon. This class contains an instance variable called pts, a reference to an array of references of type Point. Assume that the class Point provides a copy constructor. A piece of implementation of the class Polygon is given as follows:
public final class Polygon{private final Point pts[]; public Polygon(Point pts[]) { this.pts = pts; } …}
Is there anything wrong with the implementation of the copy constructor of the class Polygon? If there is, explain the error, and show a way to fix it (you will need to write a piece of code).Question 4 : This question is relevant to hw2: A student implements the AI playGood as follows:
Step 0: create a char array CardValues to store the values of cards that it flips. CardValues is initialized with 0. He writes a while loop with these steps:
Step 1: After an even number of flips, the AI check in the CardValues whether there is a matched pair and flips them.
Step 2: Flip a new card: this card must be never flipped before.
Step 3: Check if the array CardValues contains a card whose value is matched with the current card
Step 4: If there is no such card, flip a new card.
Part of his implementation for step 3 is as below:Random rnd = new Random();private char[] CardValues;…while ( !g.gameOver() ){ //Step 1: … //Step 2: flip a new card and store its value in CardValues int card1 = rnd.nextInt(); … CardValues[card1] = g.previousFlipIdentity(); //Step 3: check if CardValues contains a card that is matched card1 boolean isFound = false; for ( int i = 0; i < g.n; i++ ) { if ( g.flip(i) && CardValues[i] == CardValues[card1] ) { isFound = true; break; } } //Step 4: if isFound is false, flip a new cardWhat is wrong with his implementation in step 3? Explain your answer, and fix it. When fixing the code, do not change the entire code. The error is very simple. You only need to modify very few things. Modifying entire step 3 will not get full credit. Question 5 : Check whether 7 cards randomly selected from a deck of 52 different cards form a straight (contains 5 cards of all consecutive ranks). You must follow the guideline below:
(20pts) First, you need to “randomly select 7 cards from a deck.” Instead of using the Fisher-Yates method, you need to use this algorithm: Use a nested for loop to generate 7 different random integers between 0 and 51 inclusively. The loop needs to make sure that a new random integer is selected each time it runs its body. Do not use collections such as ArrayList, HashMap, …
Store these 7 numbers in an int array myCards.Next, assume that there is a map that maps 52 integers (from 0 to 51) to the 52 cards of a deck. One example is: 0,1,2,3 are mapped to Ace of space, Ace of heart, Ace of Diamond, and Ace of the club. And so on for 4,5,6,7,… To check a straight, we only care about the rank, not the suit. Hence, the actual mapping is: 0,1,2,3 are mapped into 1; 4,5,6,7 are mapped into 2, …, and 49,50,51,52 are mapped into 13. This map will be applied on myCards.The function Arrays.sort(myCards) will be called to sort mycards in increasing order. Further, assume that you have a static function removeDuplicate() that can remove duplicates in numeric arrays. After calling removeDuplicate(myCards), elements in myCards are arranged in a strictly increasing order. You do not need to do anything for this part. Just assume you have the array mycards in a strictly order and use that for part b.
(20pts) implement function isAStraight to check whether elements in myCards form a straight. For example 1,2,3,4,5,8,10 forms a straight, and so does 1,3,4,5,6,7. For simplicity, let assume 10,11,12,13,1 does not form a straight.
public static boolean isAStraight(int[] myCards)
You do not need to complete part a to do part b. You can assume that two parts are independent and you have results of previous parts as input for the next part.Question 6 (20pts): 6 concrete classes Charizard, Lapras, Dragonite, Pikachu, Squirtle, Wailord are derived from an abstract class Pokemon. Only Lapras, Squirtle, and Wailord can swim. These three classes implement interface Swimmable. You do not need to know the implementation of these 6 classes. //Swimmable.javapublic interface Swimmable { //swim speed in feet per minutes double getSwimSpeed ();}Assume that you have an array of 100 references to random Pokemon types.
Pokemon[] my_pokemons = new Pokemon[100];// randomly create 100 specific pokemons and store in my_pokemon// you do not need to do anything in this step.
Your pokemons are about to cross a river 5000ft wide and time is running out. You need to find one pokemon that can swim fastest to complete this task.
System.out.println(“You encountered a river 5000 ft wide !”);// ——————————————————————-/* FILL IN HEREIf no monsters can swim, print the message “Game Over”.If there is a monster that can swim, use the one with the fastest swim speed and display how long it takes to cross the river.*/ ——————————————————————-
Requirements: as clear as possible

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.