Use Java Draw two identical Cars at two different locations. You will do this by using relative positioning instead of absolute positioning, that is, you must position the components of your Car relative to a base location 1. Say you wanted to put the Car at the position (100, 100). What would the code look like in Java? 2. How can we abstract the code you wrote for question one such that we can plug in any (x, y) coordinate and create your Car relative to that position? 3. Would it be advantageous for us to create methods to draw each of the individual components of the Car and then write another method that calls each of these methods in succession? Why or why not? 4. Write out a chunk of your method (about 5 lines of the body plus the header), and diagram these parts For the implementation, you will write a method to draw your Car based on coordinates passed to it. To help you, keep the following in mind:1. There are four variables given in P2Start.java: (x1, y1) is the location of the first pad, and (x2, y2) is the location of the second pad. 2. Draw the components of your Car relative to these coordinates. For example, suppose the first pad is at (100, 200) and you want to place a leg at location (110, 230) so that it will appear 10 to the right and 30 down on the pad. Locate it at (x1 + 10, y1 + 30). In other words, every coordinate that you use to place the components of your Car must involve x1 and y1 (or x2 and y2). Your Car must contain at least 6 parts

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

Use Java

Draw two identical Cars at two different locations. You will do this by using relative positioning instead of absolute positioning, that is, you must position the components of your Car relative to a base location

1. Say you wanted to put the Car at the position (100, 100). What would the code look like in Java?

2. How can we abstract the code you wrote for question one such that we can plug in any (x, y) coordinate and create your Car relative to that position?

3. Would it be advantageous for us to create methods to draw each of the individual components of the Car and then write another method that calls each of these methods in succession? Why or why not?

4. Write out a chunk of your method (about 5 lines of the body plus the header), and diagram these parts

For the implementation, you will write a method to draw your Car based on coordinates passed to it. To help you, keep the following in mind:1. There are four variables given in P2Start.java: (x1, y1) is the location of the first pad, and (x2, y2) is the location of the second pad.

2. Draw the components of your Car relative to these coordinates. For example, suppose the first pad is at (100, 200) and you want to place a leg at location (110, 230) so that it will appear 10 to the right and 30 down on the pad. Locate it at (x1 + 10, y1 + 30). In other words, every coordinate that you use to place the components of your Car must involve x1 and y1 (or x2 and y2).

Your Car must contain at least 6 parts

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 1 images

Blurred answer
Similar questions
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