Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CO Could you please write it completely in PYTHON? Thank u so much . Question 2 (9 points): Purpose: Practice with conditionals: practice with variables
CO
Could you please write it completely in PYTHON? Thank u so much.
Question 2 (9 points): Purpose: Practice with conditionals: practice with variables and good program design. Degree of Difficulty: Easy to Moderate For this problem, we have 3 balls of different weights. Your job is to write a program that allows the user to place the balls on either side of a scale and reports which side of the scale is heavier. The left sc e is heavier. Figure 2: An example with all balls currently on the left-hand scale Here is a description of how your program should look Use a 400x300 canvas size Colour half of the screen white and the other half black. Each half of the screen represents one side of a scale. Display 3 balls on the canvas. Each ball has a different weight (1kg, 2kg and 3kg). Each ball should be a different colour, and heavier balls should be bigger. Display at all times on the canvas a message indicating whether the scale is balanced, or if not, which side is heavier, based on the position of the balls. Here is a description of how your program should behave Initially, the balls can be anywhere on the screen. In the example above, they are all on the left-hand side of the scale. When the user presses '1: The 1kg ball should be moved to the location of the mouse. When the user presses '2: The 2kg ball should be moved to the location of the mouse. When the user presses 3: The 3kg ball should be moved to the location of the mouse. Of course, the message concerning which side of the scale is heavier should be kept up to date as the balls move. Here are some suggestions for how to design your program, especially with regard to the Model-View Controller design pattern You will want to use at least 6 global variables in your program: these are the current x and y coor dinates for each of the three balls. You may wish to use another 3 global variables for the weight of each ball as well, although since the weights do not change, this is not strictly necessary. Question 2 (9 points): Purpose: Practice with conditionals: practice with variables and good program design. Degree of Difficulty: Easy to Moderate For this problem, we have 3 balls of different weights. Your job is to write a program that allows the user to place the balls on either side of a scale and reports which side of the scale is heavier. The left sc e is heavier. Figure 2: An example with all balls currently on the left-hand scale Here is a description of how your program should look Use a 400x300 canvas size Colour half of the screen white and the other half black. Each half of the screen represents one side of a scale. Display 3 balls on the canvas. Each ball has a different weight (1kg, 2kg and 3kg). Each ball should be a different colour, and heavier balls should be bigger. Display at all times on the canvas a message indicating whether the scale is balanced, or if not, which side is heavier, based on the position of the balls. Here is a description of how your program should behave Initially, the balls can be anywhere on the screen. In the example above, they are all on the left-hand side of the scale. When the user presses '1: The 1kg ball should be moved to the location of the mouse. When the user presses '2: The 2kg ball should be moved to the location of the mouse. When the user presses 3: The 3kg ball should be moved to the location of the mouse. Of course, the message concerning which side of the scale is heavier should be kept up to date as the balls move. Here are some suggestions for how to design your program, especially with regard to the Model-View Controller design pattern You will want to use at least 6 global variables in your program: these are the current x and y coor dinates for each of the three balls. You may wish to use another 3 global variables for the weight of each ball as well, although since the weights do not change, this is not strictly necessaryStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started