ask: Loading data from files This exercise will require you to load some information from files and use it in your program. scene.txt contains a description of a series of shapes and colours to draw. You need to write code to read in the file data and draw the requested shapes in the correct colour. Each line in scene.txt will contain one of the following starting keywords followed by some data:  COLOUR followed by 3 values: R, G, B  CIRCLE followed by 3 values: X, Y, RADIUS  RECT Followed by 4 values: X, Y, W, H  LINE Followed by 4 values: X1, Y1, X2, Y2 CIRCLES are defined from the center. RECT's are defined from the top left. All values are space separated, and you can assume all input is correct (no errors). Please solve this program to draw the scene.   I can't upload the file scene.txt, so I decide to screenshot a file for you.   Subject: Java Programming

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

Task: Loading data from files

This exercise will require you to load some information from files and use it in your program.

scene.txt contains a description of a series of shapes and colours to draw. You need to write code to read in the file data and draw the requested shapes in the correct colour. Each line in scene.txt will contain one of the following starting keywords followed by some data: 

COLOUR followed by 3 values: R, G, B 

CIRCLE followed by 3 values: X, Y, RADIUS 

RECT Followed by 4 values: X, Y, W, H 

LINE Followed by 4 values: X1, Y1, X2, Y2

CIRCLES are defined from the center. RECT's are defined from the top left. All values are space separated, and you can assume all input is correct (no errors). Please solve this program to draw the scene.

 

I can't upload the file scene.txt, so I decide to screenshot a file for you.

 

Subject: Java Programming

|scene.txt Notepad
File Edit Format View Help
COLOUR O 0 e
RECT 200 400 200 200
LINE 200 400 300 300
LINE 300 300 400 400
COLOUR O 0 255
RECT 280 520 40 80
COLOUR 165 42 42
RECT 550 500 50 100
COLOUR O 255 0
CIRCLE 575 450 150
Transcribed Image Text:|scene.txt Notepad File Edit Format View Help COLOUR O 0 e RECT 200 400 200 200 LINE 200 400 300 300 LINE 300 300 400 400 COLOUR O 0 255 RECT 280 520 40 80 COLOUR 165 42 42 RECT 550 500 50 100 COLOUR O 255 0 CIRCLE 575 450 150
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 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