Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. Directions Using the following guidelines, create a python program. 1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment.
4. Directions Using the following guidelines, create a python program. 1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment. 2. Create a PowerShell program named workWithFiles4.psi 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description C. Programmer's Name (You) Write code that will do the following: a. Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist. If both files exist, the program should complete steps b-h below. If either file does not exist, the program should print out the message "Unable to access one or more files". b. Get the contents of the file named dognames.txt in the CPT180Stuff\pets\dogs folder. c. Print the contents of the file. d. Get the contents of the file named catnames.txt in the CPT180Stuff pets\cats folder. e. Print the contents of the file. f. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sammy and Luna added. g. Get the contents of the file named catnames.txt. h. Print the contents of the file. 5. Submit the workWith Files4.psl file into the PowerShell Assignment Submission Folder. Hints 1. The PowerShell Add-Content command adds a newline by default. Hall cars pets cpt180 2/15/2021 11:31 PM 2/15/2021 11:31 PM 8/6/2018 11:19 AM File folder File folder Text Document 1 KB This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff cars Name Date modified Type Size familycars sportscars 2/15/2021 11:31 PM 2/15/2021 11:31 PM File folder File folder > This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > cars > familycars C.) familycars familycars familycars - Notepad File Edit Format View Help |Chevrolet Impala Honda Accord Ford Taurus Kia Optima Voltswagon Jetta Chrysler 300 This PC > 2TB Harddrive (D:) CPT180 SCreenshots > cpt180Stuff cars > sportscars =) sportscars sportscars sportscars - Notepad File Edit Format View Help Ford Mustang Chevrolet Corvette Pontiac GTO Oldsmobile 442 Porsche 911 Dodge Charger This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets Name Date modified Type cats 2/15/2021 11:31 PM 2/15/2021 11:31 PM File folder File folder dogs > This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets > cats S C:) catnames cats catnames - Notepad File Edit Format View Help Misty Felix Fluffy Kimba Tom This PC) 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets > dogs dognames dogs dognames - Notepad File Edit Format View H H- Spot Max Lassie Rover Snoopy cpt180 - Notepad File Edit Format View Help Kollege CPT 180 Shell Scripting 3 Credit Hours Example Output AL Spot Max Lassie Rover Snoopy Misty Felix Fluffy Kimba Ton Mortimer Tigger Sassy Lucy Misty Felix Fluffy Kina Ton Mortiner Tigger Sassy Lucy Santy Luna 4. Directions Using the following guidelines, create a python program. 1. You will be using the CPT180Stuff folder from the Bash Assignment for this assignment. 2. Create a PowerShell program named workWithFiles4.psi 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description C. Programmer's Name (You) Write code that will do the following: a. Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist. If both files exist, the program should complete steps b-h below. If either file does not exist, the program should print out the message "Unable to access one or more files". b. Get the contents of the file named dognames.txt in the CPT180Stuff\pets\dogs folder. c. Print the contents of the file. d. Get the contents of the file named catnames.txt in the CPT180Stuff pets\cats folder. e. Print the contents of the file. f. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sammy and Luna added. g. Get the contents of the file named catnames.txt. h. Print the contents of the file. 5. Submit the workWith Files4.psl file into the PowerShell Assignment Submission Folder. Hints 1. The PowerShell Add-Content command adds a newline by default. Hall cars pets cpt180 2/15/2021 11:31 PM 2/15/2021 11:31 PM 8/6/2018 11:19 AM File folder File folder Text Document 1 KB This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff cars Name Date modified Type Size familycars sportscars 2/15/2021 11:31 PM 2/15/2021 11:31 PM File folder File folder > This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > cars > familycars C.) familycars familycars familycars - Notepad File Edit Format View Help |Chevrolet Impala Honda Accord Ford Taurus Kia Optima Voltswagon Jetta Chrysler 300 This PC > 2TB Harddrive (D:) CPT180 SCreenshots > cpt180Stuff cars > sportscars =) sportscars sportscars sportscars - Notepad File Edit Format View Help Ford Mustang Chevrolet Corvette Pontiac GTO Oldsmobile 442 Porsche 911 Dodge Charger This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets Name Date modified Type cats 2/15/2021 11:31 PM 2/15/2021 11:31 PM File folder File folder dogs > This PC > 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets > cats S C:) catnames cats catnames - Notepad File Edit Format View Help Misty Felix Fluffy Kimba Tom This PC) 2TB Harddrive (D:) > CPT180 SCreenshots > cpt180Stuff > pets > dogs dognames dogs dognames - Notepad File Edit Format View H H- Spot Max Lassie Rover Snoopy cpt180 - Notepad File Edit Format View Help Kollege CPT 180 Shell Scripting 3 Credit Hours Example Output AL Spot Max Lassie Rover Snoopy Misty Felix Fluffy Kimba Ton Mortimer Tigger Sassy Lucy Misty Felix Fluffy Kina Ton Mortiner Tigger Sassy Lucy Santy Luna
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