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.
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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
can you write out the code for this in python?

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images

Knowledge Booster
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.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education