Answer:
<u> FlashCard.java</u>
- public class FlashCard {
- String Question;
- String Answer;
-
- public FlashCard(String q, String a){
- this.Question = q;
- this.Answer = a;
- }
-
- public String toString(){
- String output = "";
- output += "Question: " + this.Question + "\n";
- output += "Answer: " + this.Answer;
- return output;
- }
-
- public boolean equals(String response){
- if(this.Answer.equals(response)){
- return true;
- }
- else{
- return false;
- }
- }
- }
<u>Main.java</u>
- public class Main {
- public static void main(String[] args) {
- FlashCard card1 = new FlashCard("What is highest mountain?", "Everest");
- FlashCard card2 = new FlashCard("What is natural satelite of earth?", "Moon");
- FlashCard card3 = new FlashCard("Who is the first president of US?", "George Washington");
- FlashCard cards [] = {card1, card2, card3};
-
- for(int i=0; i < cards.length; i++){
- System.out.println(cards[i]);
- }
- }
- }
Explanation:
In FlashCard.java, we create a FlashCard class with two instance variable, Question and Answer (Line 2 - 3). There is a constructor that takes two input strings to initialize the Question and Answer instance variables (Line 5-8). There is also a toString method that will return the predefined output string of question answer (Line 10 - 15). And also another equals method that will take an input string and check against with the Answer using string equals method. If matched, return True (Line 17 -24).
In Main.java, create three FlashCard object (Line 3-5) and then put them into an array (Line 6). Use a for loop to print the object (Line 8-10). The sample output is as follows:
Question: What is highest mountain?
Answer: Everest
Question: What is natural satelite of earth?
Answer: Moon
Question: Who is the first president of US?
Answer: George Washington
<u>Answer:</u>
- <em>A. divide the decimal number by the base value 2</em>
- <em>C. note the remainder separately</em>
- <em>D. divide by 2 until she gets 0 as the remainder</em>
- <em>B. collect the digits in the reverse order</em>
<u>Explanation:</u>
When we want to convert decimal number to a binary number first we have divide the given number by 2. The next step is to note the reminder of the number in the side every division so that the reminder value is the binary value. Repeat this until an zero is encountered.
We have to collate all the remainders from last of first and then the collated number is the answer for the given problem.
<em>So the given option can be ordered as,
</em>
- <em>A</em>
- <em>C</em>
- <em>D</em>
- <em>B</em>
Answer:
Correct answer is
clicking on item will display a dailogbox/ more options
Explanation:
In web site menus have limited space.To add all items menus are grouped in categories and only category names are shown while there subsets are displayed in a drop down list upon hovering on them.
Some time designer user three dot indication which indicates there are more options available in a hidden side bar or dialog menu which opens upon clicking the ellipse.