Answered step by step
Verified Expert Solution
Question
1 Approved Answer
General Guidelines When Writing Programs: - Include the following comments at the top of your source codes / / - - - - - -
General Guidelines When Writing Programs:
Include the following comments at the top of your source codes
Miniprojectinclude number
Question: include questionpart number, if applicable
Written by: include your name and student ID
In a comment, give a general explanation of what your program does. As the programming
questions get more complex, the explanations will get lengthier.
Include comments in your program describing the main steps in your program.
Display a welcome message which includes your name.
Display clear prompts for users when you are expecting the user to enter data from the keyboard,
and all output should be displayed with clear messages and in an easy to read format.
End your program with a closing message so that the user knows that the program has terminated.
File Management System Implementation
You are tasked with implementing a simple file management system in Java. The
system should involve the use of inheritance and polymorphism to represent different
types of files and directories.
Requirements
Create a base class called FileSystemElement with the following attributes:
name String
size int
createdDate String
Create two derived classes called File and Directory that inherit from
FileSystemElement.
The File class should have an additional attribute: extension String
The Directory class should have an additional attribute: contents ArrayList of
FileSystemElement
Each derived class should have a constructor that initializes all of its attributes.
Implement a method called displayDetails in the FileSystemElement class that
prints out the details of the element name size, and created date
Implement a method called displayDetails in each derived class that overrides the
method in the base class and adds additional details eg extension for files, list
of contents for directories
Create a method in the Directory class called addFile that simulates adding a file
to the directory.
Test your classes by creating instances of File and Directory, setting their
attributes, and displaying their details.
Instructions
Create a new Java project and create the FileSystemElement, File, and Directory
classes as described above.
Implement the displayDetails method in each class.
Implement the addFile method in the Directory class.
Test your classes by creating instances of each class and displaying their details.
Submit your Java code and report as a single ZIP file following the submission
guidelines provided.
Submission Guidelines of miniproject
Submit your Java code and report as a single ZIP file named according to the
provided format.
Submit your ZIP file to the designated submission area on the course platform.
Include clear instructions on how to compile and run your code.
Ensure your code is welldocumented and organized.
Evaluation
Your miniproject will be evaluated based on the following criteria:
Correctness of the Java code.
Implementation of the displayDetails method in each class.
Implementation of the addFile method in the Directory class.
Testing of the classes with appropriate creation of instances and display of details.
Adherence to good coding practices, including commenting, indentation, and
proper use of variables and methods.
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