Discussion
unknown
java
2 years ago
2.8 kB
19
Indexable
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class QuestionShuffler {
public static void main(String[] args) {
List<String> easyQuestions = new ArrayList<>();
List<String> midQuestions = new ArrayList<>();
List<String> hardQuestions = new ArrayList<>();
easyQuestions.add(" What is the difference between protected and private modifier ");
easyQuestions.add(" What is the difference between protected and public modifier ");
easyQuestions.add("what is the Final keyword mean");
easyQuestions.add("what is the Static keyword mean");
easyQuestions.add("What does this mean # in uml and what is the protected modifier ");
easyQuestions.add("what is the multiple inheritance , and did you use it in the project? ");
midQuestions.add(" in compareTo Change the order to Ascending");
midQuestions.add(" Explain the is authorized method ");
midQuestions.add(" what is the Abstract method , why to use it ");
midQuestions.add(" what is the Abstract class , why to ues it");
midQuestions.add(" Explain the compareTo method");
midQuestions.add("why we use the (@Override) notation and does it necessary");
hardQuestions.add("Change the type of (CASHIER) in check class to String and implement that in isAuthorized () ");
hardQuestions.add(" Print the get balance for any check account , explain (should use type casting )");
hardQuestions.add(" Creat an CustomerPayment object with type cash and then Print the discountRate , explain (should use type casting )");
hardQuestions.add(" Print the discountRate from each cash Object in the ArrayList , explain (instanceOf with casting )");
hardQuestions.add(" Print the accountBalance from each Check Object in the ArrayList , explain (instanceOf with Casting)");
hardQuestions.add(" Count the Number of CreditCards Created (should use a static counter after isAuthorized )");
Collections.shuffle(easyQuestions);
Collections.shuffle(midQuestions);
Collections.shuffle(hardQuestions);
String easyQuestion = easyQuestions.get(0);
String midQuestion1 = midQuestions.get(0);
String midQuestion2 = midQuestions.get(1);
String hardQuestion = hardQuestions.get(0);
// Display the shuffled questions
System.out.println("\n Easy Question: " + easyQuestion);
System.out.println("Mid Questions: \n" +"[1] : "+ midQuestion1 +" [2] : " + midQuestion2);
System.out.println("\n Hard Question: " + hardQuestion);
}
}Editor is loading...
Leave a Comment