Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 7, Problem 17PE
Program Plan Intro

Program to displays a circle bouncing around the window

Program plan:

  • Import the required packages
  • In the “main()” function,
    • Create the object of “GraphWin()”.
    • Set the coordinates by calling the function “setCoords()”
    • Create an object named “shape” and store the points
    • The outline of the circle is set to “red” color.
    • The circle is filled with “red” color.
    • Draw the circle with the use of function “draw()”.
    • Declare the required variables.
    • Initialize a for loop to get the value of the points.
      • Store the center of the circle in “c”.
      • If the x-value is greater than 80 then
        • Assign the value of “dx” as “-1”.
      • If the x-value is less than -80
        • Assign the value of “dx” as “1”.
      • If the y-value is greater than 80 then
        • Assign the value of “dy” as “-1”.
      • If the y-value is less than -80
        • Assign the value of “dy” as “1”.
      • Use the function “sleep()” to slow the program.
      • Move the circle to the resulting point.
  • Call the function named “main()”

Blurred answer
Students have asked these similar questions
Write the SQL code that permits to implement the tables: Student and Transcript. NB: Add the constraints on the attributes – keys and other.
Draw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Draw an ERD that represents a book in a library system. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY