Answered step by step
Verified Expert Solution
Link Copied!

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
//-----------------------------------------------------
// Miniproject2(include number)
// Question: (include question/part 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
1. Create a base class called FileSystemElement with the following attributes:
name (String)
size (int)
createdDate (String)
2. Create two derived classes called File and Directory that inherit from
FileSystemElement.
3. The File class should have an additional attribute: extension (String).
4. The Directory class should have an additional attribute: contents (ArrayList of
FileSystemElement).
5. Each derived class should have a constructor that initializes all of its attributes.
6. Implement a method called displayDetails in the FileSystemElement class that
prints out the details of the element (name, size, and created date).
7. Implement a method called displayDetails in each derived class that overrides the
method in the base class and adds additional details (e.g., extension for files, list
of contents for directories).
8. Create a method in the Directory class called addFile that simulates adding a file
to the directory.
9. Test your classes by creating instances of File and Directory, setting their
attributes, and displaying their details.
Instructions
1. Create a new Java project and create the FileSystemElement, File, and Directory
classes as described above.
2. Implement the displayDetails method in each class.
3. Implement the addFile method in the Directory class.
4. Test your classes by creating instances of each class and displaying their details.
5. Submit your Java code and report as a single ZIP file following the submission
guidelines provided.
Submission Guidelines of miniproject2
1. Submit your Java code and report as a single ZIP file named according to the
provided format.
2. Submit your ZIP file to the designated submission area on the course platform.
3. Include clear instructions on how to compile and run your code.
4. Ensure your code is well-documented and organized.
Evaluation
Your miniproject2 will be evaluated based on the following criteria:
1. Correctness of the Java code.
2. Implementation of the displayDetails method in each class.
3. Implementation of the addFile method in the Directory class.
4. Testing of the classes with appropriate creation of instances and display of details.
5. 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

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What other recovery options does Recuva come with?

Answered: 1 week ago

Question

How does that affect your approach to complaint handling?

Answered: 1 week ago