Question: Composition Design Pattern File / Folder combination is a typical example of the composite design pattern. A file has a name, size, and extension. A

Composition Design Pattern
File/Folder combination is a typical example of the composite design pattern. A file has a name, size, and extension.
A folder has similar attribute (without an extension) plus a list of files or other folders. You are required to write a
demonstration application that traverses files and folders in a selected directory.
Class diagram
Design a class diagram showing the above-mentioned structure using the composite design oastern. You have to
show all companents including the Application class.
Application
[90 marks]
Implement a Net deskitop application (CH or VB) by which you can choose a certain folder when the program starts.
Once you select a folder, you should recursinely traverse all of its contents (files and folders) and fill the required
information as follows:
Folder : only name
File : name, size, extension
After traversing, your application should use the traversed structure you just created to visualize the size of files and
Folders inside a certain folder. A sketch of the application is shown below.
When the program starts, it should have default directory (C-Drive, for example). You should show its contents in
Area A (in the picture above). If the user wants to select another folder, he can click the "Browse Button". Whenever
the user selects a folder or a sub folder in Area A, you should visualize its contents as shown in Area B. Your
visualization can appear as a Bar Chart (as shown in Figure 1) or as a Pie Chart (as shown in Figure 2- shown below).
For the Bar-Chart option, you should draw it yourself without using a component. For the Pie-Chart option, you can
use any ready component that you might find.
For testing purposes, use a reasonable sized folder (small but contains sub folders)
Requirements:
Develop your program to fulfill the following requirements:
1- When executed, it should display a button and give the user the freedom of choosing the folder to visualize.
a. For your testing purposes, you can hardcode the folder while you are testing.
2- Once the user select a folder, you should display the visualization on a panel inside your main form.
a. The Bar-Chart visualization should be done by code (You can't use any ready components)
b. For Pie-Chart visualization, you can use any ready component.
3- The Application should be able to respond to the changes in the size of the form (i.e, bigger or smaller in
5- You should allow the user to change visualization from Bar-Chart and Pie-Chart and vice versa.
NOTE: Your program should reflect your class diagram
Class diagram (with Strategy Pattern)
[10 marks]
Visualizing the folders in two different ways represents a good case for the Strategy Design Pattern. Draw a class
diagram showing the application using this pattern. You have to show all components including the Application class.
Composition Design Pattern File / Folder

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!