Question
Assignment 1 Create a Java class named Assignment1 (1 mark deduction if not). The package name should be assignment1. *Please note the case sensitivity. The
Assignment 1 Create a Java class named Assignment1 (1 mark deduction if not). The package name should be assignment1. *Please note the case sensitivity. The class name should start with an uppercase A and the package name should start with a lowercase a. It is to have a main method that calls each of the static methods below (2 marks deducted if not) Task 1: 6 marks Create a static method named task1 1) Ask the user for a file name (You will automatically add the txt extension to the file name) (1 mark) 2) Ask the user for text content to add to the file. (1 mark) 3) Write or append to the file in Step 1) the text content in Step2) (4 marks) Task 2: 14 marks Create a static method named task2 1) Ask the user for a relative path value. (1 mark) 2) Determine if the relative path exists (3 marks) a) If not found: i) output to Standard Error an appropriate message and end the program (1 mark) b) If found: i) Output the count of all files and folders found. This count should include subdirectories. Output a total count, a file count and a directory count. (9 marks) Please scroll to next page to see an example Example: If the current working directory structure is: out (empty) src comp1008 wk1 (empty) wk2 Week2a.java Week2b.java wk3 (empty) comp1011 wk1 Box.java BoxRunner.java wk2 Shoe.java ShoeRunner.java properties.cnf And User input: ./ (The current working directory) Program Output: There are 16 total files and directories; 7 files & 9 directories.
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