timer Asked: Jul 22nd, 2013

Question description

In the main class of our application we will query the operating system for a directory listing like this:

        Process p = Runtime.getRuntime().exec("cmd /C dir /Q c:\\windows\\temp");
        Scanner fromOS = new Scanner(p.getInputStream());
Define a class named MyFileSystem based on this UML Class diagram.

Your program will read each record from the input stream, extract the required information needed to pass into a MyFileSystem constructor method.

Your program will store each of the MyFileSystem objects in an ArrayList.

You will only gather data for regular files, skip the directory listings.

Calendar is an abstract class which means you cannot use 'new' to instantiate an object. Creating a Calendar object and setting it equal to the time information you read from the input stream is a multi-step operation. Use this a model for how to do this. The mask you choose for the SimpleDateFormat constructor must match the pattern of data in the String you want to massage into a Calendar object. 

String massage = "06/14/2011 10:34 PM";
        Calendar stamp = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
There are many ways to get information out of a Calendar object after you create one. If you use the get() method you have to feed that method a pre-defined constant that Calendar will recognize. Something like this will return an int representing the year.

  1. Most of the programming work in this lab will happen in the Lab1 class. You should be writing many helper methods in the Lab1 class to keep your design very modular. Each method does one little thing. So typically the main method of your Lab1 class will be a series of calls to various methods that do the real work such as parsing the strings to get the bits of data you need. Generating a report should also go in a separate method.

        Write documentation for the javadoc utility and a description of what your      program will do.

My code so far...

import java.util.Calendar;

public class MyFileSystem {

    private long fileSize;

    private Calendar timeStamp;

    private String owner;

    private String fileName;


    //  constructor

    public MyFileSystem(long fs, Calendar ts, String fo, String fn){



    public long getFileSize(){

        return 0L;



    public Calendar getTimeStamp(){

        return new Calendar();



    public String getOwner(){

        return "";



    public String getFileName(){

        return "";




Tutor Answer

(Top Tutor) Studypool Tutor
School: Purdue University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors