Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MIV Home - Looking Glass zy Section 8.7 - CS 172: Computer Science I zyBooks My library > CS 172: Computer Science I home
MIV Home - Looking Glass zy Section 8.7 - CS 172: Computer Science I zyBooks My library > CS 172: Computer Science I home > 8.7: LAB: File name change 8.7 LAB: File name change Instructor note: ParkPhotos.txt learn.zybooks.com There will be two Scanner objects in the program. One Scanner will be used to read file name from the keyboard (System.in). To read data from a file you need to create a FileInputStream object associated with the given file and another Scanner object for the FileInput- Stream object. Use a loop to read lines one by one from the file, replace the "photo.jpg" portion with "info.txt", and output the modified file names. and the contents of ParkPhotos.txt are: A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Acadia2003_photo.jpg Homework Help - Q&A from Online Tutors - Course Hero Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: American Samoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg What's the difference between a Premier Memb CarlsbadCaverns 2010_photo.jpg Crater Lake 1996_photo.jpg Grand Canyon 1996_photo.jpg . IndianaDunes1987 photo.jpg zyBooks catalog ? Help/FAQ Katie Ale my Home Looking Glass NM - ParkPhotos.txt =zyBooks My library > CS 172: Computer Science I home > 8.7: LAB: File name change zy Section 8.7 - CS 172: Computer Science I and the contents of ParkPhotos.txt are: Acadia2003_photo.jpg American Samoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns 2010_photo.jpg CraterLake1996_photo.jpg Grand Canyon 1996_photo.jpg IndianaDunes1987_photo.jpg Lake Clark2009_photo.jpg Redwood1980_photo.jpg Virgin Islands 2007_photo.jpg Voyageurs2006_photo.jpg WrangellStElias1987_photo.jpg the output of the program is: Acadia2003_info.txt American Samoa1989_info.txt BlackCanyonoftheGunnison1983_info.txt Carlsbad Caverns 2010_info.txt Crater Lake 1996_info.txt Grand Canyon 1996 info.txt IndianaDunes1987_info.txt Lake Clark2009_info.txt Redwood1980_info.txt VirgiIslands 2007_info.txt Voyageurs2006_info.txt WrangellStElias1987_info.txt 423062.2712980.qx3zqy7 LAB learn.zybooks.com 871 LAB File name change Homework Help - Q&A from Online Tutors - Course Hero What's the difference between a Premier Membership... EzyBooks catalog 0 + 88 0/10 ? Help/FAQ 8 Katie Aleman Y my NM Home - Looking Glass LAB ACTIVITY EzyBooks My library > CS 172: Computer Science I home > 8.7: LAB: File name change 8.7.1: LAB: File name change Downloadable files ParkPhotos.txt zy Section 8.7 - CS 172: Computer Science I 1 import java.util.Scanner; 2 import java.io.FileInputStream; 3 import java.io.IOException; 4 } Develop mode Download Run program 5 public class LabProgram { 6 public static void main(String[] args) throws IOException { 7 Scanner scnr = new Scanner(System.in); 8 9 * Type your code here. */ 10 11 } 12 learn.zybooks.com Submit mode Enter program input (optional) If your code requires input values, provide them here. Homework Help - Q&A from Online Tutors - Course Hero LabProgram.java Input (from above) LabProgram.java (Your program) zyBooks catalog What's the difference between a Premier Membersh Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. 0/10 Output (shown below) Load default template... ? Help/FAQ 8 Katie Alema + h
Step by Step Solution
★★★★★
3.51 Rating (168 Votes )
There are 3 Steps involved in it
Step: 1
It seems like youve provided the instructions and template for a Java program that needs to read a l...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