Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My professor asked me to write a java program that will pull comments from another java file and display in a .txt file. I wrote
My professor asked me to write a java program that will pull comments from another java file and display in a .txt file. I wrote the program and tested to make sure it works but he still gave me a 0 for my score. The reason for this is he said there is a required main class: CScrape. I am confused and am not sure what he means by that. Ill attach a picture of my program. pse Project Run Window Help 2e import java.io.File:D public class Cscrape ( Pls pihlie statie vota maincstringtr Scanner keyboard new Scanner(System.in) int lineNumber 1; System.out.println("Enter input file:) String inFile keyboard.nextline) try f File reader = new File(inFile); Scanner in new Scanner(reader); inFile inFile.replace(.java, .txt) Printhriter txtFile - new Printriter(infile); System.out.println("InThe txt file nane is: in txtFile.println("Comment Scrape R. Michael) uhle(in.hasNextLine()) { String line in.nextline() lineNumber++; if (line.contains("I txtFile.println(linekumber+ line.substring if (line.contains()) txtFile.print1n(lineNumber + line. substring while(! line.contains(")) line in.nextline): pse Project Run Window Help 2e import java.io.File:D public class Cscrape ( Pls pihlie statie vota maincstringtr Scanner keyboard new Scanner(System.in) int lineNumber 1; System.out.println("Enter input file:) String inFile keyboard.nextline) try f File reader = new File(inFile); Scanner in new Scanner(reader); inFile inFile.replace(.java, .txt) Printhriter txtFile - new Printriter(infile); System.out.println("InThe txt file nane is: in txtFile.println("Comment Scrape R. Michael) uhle(in.hasNextLine()) { String line in.nextline() lineNumber++; if (line.contains("I txtFile.println(linekumber+ line.substring if (line.contains()) txtFile.print1n(lineNumber + line. substring while(! line.contains(")) line in.nextline)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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