Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dear student! Please follow the instructions to solve the problems: (a) Write down an algorithm to solve this problem (b) Draw the flowchart of the

image text in transcribed
image text in transcribed
Dear student! Please follow the instructions to solve the problems: (a) Write down an algorithm to solve this problem (b) Draw the flowchart of the proposed algorithm (C) Write down the Java program for the solution (d) Run your Java program in IDE NetBeans NB! 1. The typical answer on the question expected to be graded with full mark can be found on the next page. Qos. It is convenient to quickly backup everything in a directory. Of course, this does not protect against dink failure, but it does protect against accidental deletion. Write a program that backs up all the files in a directory by creating a new subdirectory of the current directory) called backUp and by copying all files of the current directory into it. The file names of the copies are the same as in the current directory. If backUpo already exists, then delete it and create a new one. If a file cannot be read (check this with conRead), write a waring message and continue. The name of the directory to backup bas to be entered by a user. Hint: Use the list method of File to get a list of files and directories. Use the isFile method to determine which of the list are files. Use sukdir to create the new directory Example: Directory to backup: true? backup filel.at filel.at file2.mx file2.txt hello (folder) udar temporary (folder) aur dar aux (folder) Expected ptototype of the answer on typical question in the Assignment Q1. Write a Java program that creates an empty. Program print out a message "File created: filename" if file is created or "File already exists." il file already exists. The file name has to be entered by a use. 6 (*) Write down an algorithm to solve this problem 1 Start Print Input filename 3. Read a name of the file to create Create flie 5 i fle is crented print -File created: Plename" else print File already exists End (1) Draw the flowchart of the proposed algorithm (Figure 1) (c) Write down the Java program for the solution import exs.de. import IX.10.JRENCER import extilcone public class Scenteile! public static void durinistrin aces) tryt Scanner in = new Scannersystem.in); String filename = in.next(): File mxtile = new File(filename): if (tile.seateNewsle satem.out.printin/"File created+mte.setNome: else System est eritior"); } catch is e) { System.out.println("An error occurred"); BiStack tracell: 6-10.0-4-1 Do it like this example (6) Run your Juve program in IDE NetBeans please fications Output - Fles rund X File created input.txt BUILD SUCCESSFUL total tine seconds

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions