Find Jobs
Hire Freelancers

Write a program that uses recursion to draw squares- one square on the corner of each square.

$10-30 USD

ถูกยกเลิก
โพสต์ มากกว่า 7 ปีที่ผ่านมา

$10-30 USD

ชำระเงินเมื่อส่งงาน
Write a program that uses recursion to draw squares- one square on the corner of each square. You can write an applet or a standalone GUI program. Either is fine. Requirements Your program should have instance data that defines: the initial size of the largest square the minimum length of a size of a square by what factor you shrink the size for each round of squares Your program will include a recursive method to draw a square. The method should draw one square (the small part of the problem it solves now). The method should then recursively call itself to draw the four squares at the corner of the current square. (The sides of these smaller squares are reduced by some factor.) The recursive method should be initially invoked once from the paint or paintComponent method. Consider: What parameters should that method have? What initial values are sent into the first call to this method? When does the method stop (what is the base case)? Notes In my sample below, I use an initial side length of 200, a minimum side length of 10, and I cut the size of a side in half each time. You do not have to use these values- experiment with your own. In the sample, I fill the square in gray and then draw the outline in black. You are not required to do this. I include a couple versions of the sample output below. You only need to submit one version of your program. I recommend first getting the program working with using a method to draw a single square. I strongly recommend sketching out the coordinates on paper before attempting to put them into code. I have provided template code that you can use to start from for an applet or a standalone program. You are not required to use this. Extra Credit (15 points) Instead of drawing a square, draw a different polygon (e.g., any closed-sided figure but not a circle, square, or rectangle). It could be a triangle, parallelogram, trapezoid, be creative! Note: If completing the extra credit, you do not need to do both the square version and the extra credit- you can complete only the extra credit. If you want to see what this looks like with fewer squares, to get a better sense of what is going on, here are two images that use a minimum side length of 50 and 100.
รหัสโปรเจกต์: 11754506

เกี่ยวกับโปรเจกต์

5 ข้อเสนอ
โปรเจกต์ระยะไกล
ใช้งานอยู่ 8 ปีที่ผ่านมา

กำลังมองหาการสร้างรายได้ใช่ไหม?

ประโยชน์ของการประมูลกับ Freelancer

กำหนดงบประมาณและกรอบเวลาของคุณ
รับเงินจากการงานของคุณ
อธิบายข้อเสนอของคุณในภาพรวม
ลงทะเบียนและเสนอราคาฟรี
5 ฟรีแลนซ์กำลังเสนอราคาโดยเฉลี่ย $57 USD สำหรับงานนี้
รูปอวาตาร์ของผู้ใช้
I have experience working with images and java. I could comment the code if needed.
$30 USD ใน 2 วัน
0.0 (0 รีวิว)
0.0
0.0

เกี่ยวกับลูกค้า

ปักธงของ UNITED STATES
San Jose, United States
5.0
7
ยืนยันวิธีการชำระเงินแล้ว
เป็นสมาชิกตั้งแต่ ส.ค. 24, 2016

การยืนยันลูกค้า

ขอบคุณ! เราได้ส่งลิงก์สำหรับเครดิตฟรีให้คุณทางอีเมลแล้ว
เกิดข้อผิดพลาดขณะส่งอีเมลของคุณ กรุณาลองอีกครั้ง
โลโก้ Freelancer Thailand / ภาษาไทย ช่วยเหลือและสนับสนุน FreelancerประเภทโปรเจคการประกวดFreelancerองค์กรแพ็กเกจสมาชิกโครงการ Freelancer ชั้นแนวหน้าการจัดการโปรเจคงานในพื้นที่Photo Anywhereหน้าจัดแสดงผลงานAPI สำหรับนักพัฒนาได้รับการยืนยันDesktop App เกี่ยวกับเกี่ยวกับเราวิธีใช้งานความปลอดภัยนักลงทุนแผนผังเว็บไซต์เรื่องราวข่าวออกสื่อทีมรางวัลข่าวประชาสัมพันธ์ร่วมงานกับเรา ข้อกำหนดนโยบายความเป็นส่วนตัวข้อกำหนดและเงื่อนไขนโยบายลิขสิทธิ์ข้อพึงปฏิบัติค่าธรรมเนียมและค่าบริการหุ้นส่วนEscrow.comLoadshiftWarrior Forum แอปโลโก้ Apple App Store โลโก้ Google Play
ไม่สามารถคัดลอกไปยังคลิปบอร์ดได้ โปรดลองอีกครั้งหลังปรับเปลี่ยนการอนุญาต
คัดลอกไปยังคลิปบอร์ดแล้ว
ผู้ใช้ที่ลงทะเบียน งานที่มีการโพสต์ทั้งหมด
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
กำลังโหลดตัวอย่าง
ได้รับอนุญาตสำหรับตำแหน่งทางภูมิศาสตร์
เซสชั่นการเข้าสู่ระบบของคุณหมดอายุและคุณได้ออกจากระบบแล้ว กรุณาเข้าสู่ระบบอีกครั้ง