Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago