Unlock access to all the studying documents.
View Full Document
Student Name: __________________
Class and Section __________________
Total Points (20 pts) __________________
Due: September 8, 2010 before the class
Project: Getting Number of Files in a Directory
CSCI 2410 DS
Armstrong Atlantic State University
Problem Description:
Write a program that prompts the user to enter a directory
and displays the number of the files in the directory.
Name the public class Exercise18_29
Testing: (Describe how you test this program)
Submit the following items:
1. Print this Word file and Submit to me before the class on the due day
Code Solution:
import java.io.File;
import java.util.Scanner;
public class Exercise18_29 {
public static void main(String[] args) {
// Prompt the user to enter a directory
public static long getNumberOfFiles(File file) {
long numberOfFiles = 0; // Store the total size of all
files
if (file.isDirectory()) {
File[] files = file.listFiles(); // All files and
subdirectories
}