I have an unfinished java class, I need to write 4 methods there 1st step : create a file reader that reads the shape files supplied to you. Eachline of the shape file specifies a shape. The format of this line differs depending on the shape ( files supplied to me : ExampleShapes.txt, TwoRedCircles.txt, and ExampleShapesStill.txt) step 2 : I would start by trying to read a single line of the file followed by multiple lines, printing them to the screen to ensure you are reading the data correctly. Then, cre- ate instances of the shape objects and print them out. You can do this by calling the toString() method that has already been given to you. step 3: If the file does not exist, quit the program grace- fully and output Could not find to the screen (standard out) with re- placed by the file that will not open. However, you can assume that each line of the file has the cor- rect syntax. To test your code, please try to run the TwoRedCircles.txt file.  step 4: Start by printing out each line your read to the terminal to make sure you are reading the data correctly. Then, create instances of the objects and use the toString() method to print out the object and make sure that it is being cre- ated correctly.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Reposting as I was getting the wrong answers!!! Java only and please read the description

I have an unfinished java class, I need to write 4 methods there

1st step : create a file reader that reads the shape files supplied to you. Eachline of the shape file specifies a shape. The format of this line differs depending on the shape ( files supplied to me : ExampleShapes.txt, TwoRedCircles.txt, and ExampleShapesStill.txt)

step 2 : I would start by trying to read a single line of the file
followed by multiple lines, printing them to the screen
to ensure you are reading the data correctly. Then, cre-
ate instances of the shape objects and print them out.
You can do this by calling the toString() method
that has already been given to you.

step 3: If the file does not exist, quit the program grace-
fully and output Could not find <filename>
to the screen (standard out) with <filename> re-
placed by the file that will not open. However, you
can assume that each line of the file has the cor-
rect syntax. To test your code, please try to run the
TwoRedCircles.txt file. 

step 4: Start by printing out
each line your read to the terminal to make sure you
are reading the data correctly. Then, create instances
of the objects and use the toString() method to
print out the object and make sure that it is being cre-
ated correctly.

 

import javafx.scene.paint.Color;
import java.io.*;
import java.util.Scanner;
public class ReadShapeFile {
// TODO: YoU will likely need to write four methods here. One method to
// construct each shape
// given the Scanner passed as a parameter. I would suggest static
// methods in this case.
/** Reads the data file used by the program and returns the constructed queue ...*)
private static Queue<ClosedShape> readLineByLine(Scanner in) {
Queue<ClosedShape> shapeQueue = new Queve<ClosedShape>();
//read in the shape files and place them on the Queue
//Right now, returning an empty Queue.
You need to change this.
return shapeQueue;
}
Transcribed Image Text:import javafx.scene.paint.Color; import java.io.*; import java.util.Scanner; public class ReadShapeFile { // TODO: YoU will likely need to write four methods here. One method to // construct each shape // given the Scanner passed as a parameter. I would suggest static // methods in this case. /** Reads the data file used by the program and returns the constructed queue ...*) private static Queue<ClosedShape> readLineByLine(Scanner in) { Queue<ClosedShape> shapeQueue = new Queve<ClosedShape>(); //read in the shape files and place them on the Queue //Right now, returning an empty Queue. You need to change this. return shapeQueue; }
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY