Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 6 (20 marks) Online Islamic Encyclopedia is trying to create a list of wars in the Islamic history. You are given the definition of
QUESTION 6 (20 marks) Online Islamic Encyclopedia is trying to create a list of wars in the Islamic history. You are given the definition of War, TreeNode and BSTWar ADTS; TreeNode ADT TreeNode left War data TreeNode right public TreeNode (Object) BSTWar ADT TreeNode root public BSTWar() public void countWarByKhalidAlWalid() public void displayWar() public void displayAsc() public int count TotalSoldiers () War ADT String warName //ex: Badr, Hunain, etc String Commander //ex: Prophet Muhammad SAW, Khalid Al Walid etc int year // year the war happened int numberOfSoldiers public War (String, String, int, int) public String getWarName) public String getCommander() public int getYear() public int getsoldiers () public String toString() The following table shows the sample of the wars in the Islamic history: War Name Hunain Nihawand Badr Hira Uhud Yarmouk Khandag Hattin Tabuk Khaybar Balkan Commander Prophet Muhammad SAW Nu'man Muqarrin Prophet Muhammad SAW Khalid Al Walid Prophet Muhammad SAW Khalid Al Walid Prophet Muhammad SAW Salahuddin Al Ayyubi Prophet Muhammad SAW Prophet Muhammad SAW Usamah bin Zaid Year 630 642 624 633 625 636 627 1187 631 629 632 Number of soldiers 12000 30000 313 10000 700 15000 3000 20000 30000 1400 3000 a) b) c) Draw the BST diagram based on the year the war occurred. (4 marks) Define method countWarByKhalidAlwalid() and its recursive method to calculate and display the number of wars commanded by Khalid AlWalid. (5 marks) Write method definition for displayWar() and its recursive method to display the names of all Wars that happened before the death of the Prophet Muhammad SAW in the year 632 (5 marks) Write the definition for displayAsc() and its recursive method to display the war in ascending order according to year. (3 marks) Write the definition for countTotalsoldiers () and its recursive method to count and return the total number of soldiers involved in all wars. (3 marks) d) e) QUESTION 6 (20 marks) Online Islamic Encyclopedia is trying to create a list of wars in the Islamic history. You are given the definition of War, TreeNode and BSTWar ADTS; TreeNode ADT TreeNode left War data TreeNode right public TreeNode (Object) BSTWar ADT TreeNode root public BSTWar() public void countWarByKhalidAlWalid() public void displayWar() public void displayAsc() public int count TotalSoldiers () War ADT String warName //ex: Badr, Hunain, etc String Commander //ex: Prophet Muhammad SAW, Khalid Al Walid etc int year // year the war happened int numberOfSoldiers public War (String, String, int, int) public String getWarName) public String getCommander() public int getYear() public int getsoldiers () public String toString() The following table shows the sample of the wars in the Islamic history: War Name Hunain Nihawand Badr Hira Uhud Yarmouk Khandag Hattin Tabuk Khaybar Balkan Commander Prophet Muhammad SAW Nu'man Muqarrin Prophet Muhammad SAW Khalid Al Walid Prophet Muhammad SAW Khalid Al Walid Prophet Muhammad SAW Salahuddin Al Ayyubi Prophet Muhammad SAW Prophet Muhammad SAW Usamah bin Zaid Year 630 642 624 633 625 636 627 1187 631 629 632 Number of soldiers 12000 30000 313 10000 700 15000 3000 20000 30000 1400 3000 a) b) c) Draw the BST diagram based on the year the war occurred. (4 marks) Define method countWarByKhalidAlwalid() and its recursive method to calculate and display the number of wars commanded by Khalid AlWalid. (5 marks) Write method definition for displayWar() and its recursive method to display the names of all Wars that happened before the death of the Prophet Muhammad SAW in the year 632 (5 marks) Write the definition for displayAsc() and its recursive method to display the war in ascending order according to year. (3 marks) Write the definition for countTotalsoldiers () and its recursive method to count and return the total number of soldiers involved in all wars. (3 marks) d) e)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started