Purpose: Practice with conditionals; practice with variables and good program design. Degree of Difficulty:MOD For this problem, you will write a program that will allow a user to calculate a letter-based grade, based on a grade percentage. Here is a description of how your program should look and behave: . Initially, text "Grade Calculator" and "Average: should be displayed on the canvas as seen in Figure 1. (Do not worry about matching exact color or size.) . When the user presses a key, show the keys pressed beside 'Average". . When the user clicks the mouse, show the calculated grade in the bottom right corner of the canvas. • If a grade is showing and the user clicks the mouse, reset the canvas, clearing both the grade and average text. (The canvas should looke like it initially did.) Grade Calculator Average: Grade Calculator Average: 65 Figure 1: The initial canvas ready for input (left). The canvas after a user presses 6 and 5 (middle). The canvas after the user clicks the mouse (right). Below is a table of which grade should be assigned to each average. Average 90 - 100 80 - 89 70 - 79 60 - 69 0-59 Grade Calculator Average: 65 D Grade A B D F 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 2 global variables in your program: these are the current keys pressed and the grade to be displayed. • You should have a function that takes an average as a parameter. This function should have condi- tionals to determine the appropriate grade and return it. • Your keyPressed() function should update your global keys pressed variable. • Your mouseClicked() function should have a conditional. It will either calculate an appropriate grade. or reset the canvas.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 7E: (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or...
icon
Related questions
Question

can you write out the code for this in python?

Purpose: Practice with conditionals; practice with variables and good program design.
Degree of Difficulty:MOD
For this problem, you will write a program that will allow a user to calculate a letter-based grade, based
on a grade percentage.
Here is a description of how your program should look and behave:
• Initially, text "Grade Calculator" and "Average:" should be displayed on the canvas as seen in Figure 1.
(Do not worry about matching exact color or size.)
• When the user presses a key, show the keys pressed beside "Average".
• When the user clicks the mouse, show the calculated grade in the bottom right corner of the canvas.
. If a grade is showing and the user clicks the mouse, reset the canvas, clearing both the grade and
average text. (The canvas should looke like it initially did.)
Grade Calculator
Average:
Grade Calculator
Average: 65
Figure 1: The initial canvas ready for input (left). The canvas after a user
presses 6 and 5 (middle). The canvas after the user clicks the mouse (right).
Grade Calculator
Average: 65 D
Below is a table of which grade should be assigned to each average.
Average Grade
90-100
A
80 - 89
B
70 - 79
с
60 - 69
D
0-59
F
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 2 global variables in your program: these are the current keys pressed
and the grade to be displayed.
• You should have a function that takes an average as a parameter. This function should have condi-
tionals to determine the appropriate grade and return it.
Your keyPressed() function should update your global keys pressed variable.
Your mouseClicked() function should have a conditional. It will either calculate an appropriate grade.
or reset the canvas.
Transcribed Image Text:Purpose: Practice with conditionals; practice with variables and good program design. Degree of Difficulty:MOD For this problem, you will write a program that will allow a user to calculate a letter-based grade, based on a grade percentage. Here is a description of how your program should look and behave: • Initially, text "Grade Calculator" and "Average:" should be displayed on the canvas as seen in Figure 1. (Do not worry about matching exact color or size.) • When the user presses a key, show the keys pressed beside "Average". • When the user clicks the mouse, show the calculated grade in the bottom right corner of the canvas. . If a grade is showing and the user clicks the mouse, reset the canvas, clearing both the grade and average text. (The canvas should looke like it initially did.) Grade Calculator Average: Grade Calculator Average: 65 Figure 1: The initial canvas ready for input (left). The canvas after a user presses 6 and 5 (middle). The canvas after the user clicks the mouse (right). Grade Calculator Average: 65 D Below is a table of which grade should be assigned to each average. Average Grade 90-100 A 80 - 89 B 70 - 79 с 60 - 69 D 0-59 F 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 2 global variables in your program: these are the current keys pressed and the grade to be displayed. • You should have a function that takes an average as a parameter. This function should have condi- tionals to determine the appropriate grade and return it. Your keyPressed() function should update your global keys pressed variable. Your mouseClicked() function should have a conditional. It will either calculate an appropriate grade. or reset the canvas.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Literals
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr