Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Zybooks is very strict on its outputs. This is requiring a new line. Can someone look at my code and help fix the problem? ompare
Zybooks is very strict on its outputs. This is requiring a new line. Can someone look at my code and help fix the problem?
ompare output Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input ParkPhotos.txt Acadia2003 info.txt American Samoa1989 info.txt BlackCanyonoftheGunnison 1983. info.txt CarlsbadCaverns 2010 info.txt Craterlake1996 info.txt Grandcanyon 1996 info.txt Indiana Dunes1987_info.txt LakeClark2009 into.txt Redwood1980 into.txt Virginislands 2007_info.txt Voyageurs 2006_info.txt Wrangellstelias1987 info.txt Your output Acadia2003_info.txt American Samoa1989 info.txt BlackCanyonoftheGunnison 1983 into.txt CarlabadCaverns2010_info.txt CraterLake 1996 info.txt GrandCanyon 1996_info.txt Expected output IndianaDunes 1987 info.txt LakeClark2009 info.txt Redwood1980 info.txt Virginislands 2007 info.txt Voyageurs 2006_info.txt Wrangelistellas 1987_into.txt 8 1 import java.util.Scanner; Z import java.io."; 3 import java.io.IOException; 4 public class LabProgram S public static void main(String[] args) { 6 Scanner scnr-new Scanner(System.in); String filename = scnr.nexto: || try{ 9 FileInputStream fs = new FileInputStream(new File(filename)); 10 while(true){ String str ""; int ch; while((ch - fs.read() != -1){ ' 'break; str(char)ch; } System.out.println(str.replace("_photo.jpg","_info.txt")); if(ch break; } if(ch 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 fs.closeO: } catch (IOException e) e.printStackTrace(); } scnr.close(); 27 28 ) 29 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