0% found this document useful (0 votes)
26 views2 pages

Data Structure Midterm Lab Project

Uploaded by

Samer Kouta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Data Structure Midterm Lab Project

Uploaded by

Samer Kouta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Midterm Project — Data Structure Exercise: Write a java program with the following: - Class ArrayChar that have as private attribute (char[] arr, int size) and it can apply all the methods of ArrayList depending on basic array implementation and algorithm -- ArrayChar can be resizable at any size (similar to be ArrayList but it is not). - Class Stack that can apply all the methods of stack (the implementation Is based on ArrayChar) where the top of stack is the beginning of ArrayChar - Add method Reverse in stack class to reverse a String of characters (entered as. parameter) based on stack methods (push and pop). You can accept from input (char or String) - Method searchFor that can accept also a char or a String you asked for and return an ArrayList contains the count of each char exists in stack - Menu that accepts the input from scanner and output the result based on your choice - Class main to instance ArrayChar and Stack and apply the code of the menu NB: The Following sample run explain how program work (read it carefully). And it should be repeated until you choose to exit. - Choices from 1 to 6 should be based on ArrayChar and from 7 to 12 should be based on Stack Sample Run: The Menu > Insert in Beginning - Insert in end - Insert in particular position . Delete from beginning . Delete from end . Delete from position Push - pop « Length 10. Reverse 11. Display 12. Repeated character 0. Bxit Sample Run: Execution example Enter your choice: 1 Enter a characte! © c is entered at first Enter your choice: 2 Enter a character: bed bed is entered at end 10 Enter your choic The reverse string i: 1 Enter your choic The string is: cbed Enter your choic: b is pushed into stuck Enter your choice: 12 Enter a character to search for: b is found: 2 times Enter your choice: 12 Enter a character to search for: b is found: 2 times e is found: 1 time Enter your choice: 0 Good Bye Exercise 2: debe be - Isit possible to replace the Stack project in exercise_1 by a Queue? — If possible: rewrite the code using LinkedList implementation to do the same menu. ~ If not possible: Explain why

You might also like