Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The objectives of this assignment focus on step - wise development, menu driven interface using a while loop, dictionaries and secure programming using try /
The objectives of this assignment focus on stepwise development, menu driven interface using a while loop, dictionaries and secure programming using tryexcept and includes an opportunity for extra credit.
For stepwise development, you'll develop the application in three steps, with points allotted for each step. The idea is to start simple. Don't try and do everything at once. Get one piece of the application to work, build on that success to get the next piece to work and so on You'll write three separate programs: steppy steppy and steppy First you'll complete steppy make a copy of it as a starting point for steppy Once steppy is complete, you'll make a copy to use as a starting point for steppy Submit all three programs.
The purpose of the application is to build the configuration for a window using a dictionary to define the attributes. You'll provide a user interface, via the while loop, to the user so that the user can choose to enter attributes, display the attributes and determine the aspect ratio screen width vs height of the window. You'll also use secure programming techniques tryexcept to make sure that bad input data cannot crash the program.
Video demonstrations of how each step should work are included at the end of the directions for each step.
Step points
In this step, you'll build the basic user interface and create the dictionary. Refer to the Menu Drive Interface videoLinks to an external site. from Week
Create an empty dictionary named windowattributes
Create a menu display that looks like this:
Window Administration Application
a: Exit application
b: Enter an attribute
c: Calculate and display the aspect ratio.
d: Display the window attributes and values
Each time the while loop runs, the menu should be displayed.
After displaying the menu, prompt the user to choose a b c or d
If a is entered, exit the while loop and display, "Done!".
For menu selections b c and d simply confirm the selection. The actual work is part of another step.
For b indicate, "Entering an attribute selected".
For c display "Calculate aspect ratio selected".
For d display "Display the attributes and values selected".
If the user entered anything else, note that only a b c or d are acceptable input validation
Save the program as steppy
Step points
For this step, implement menu selections b and d
Make a copy of steppy to use as a starting point for this step.
For menu selection b
Query the user for an attribute name, using the input command.
Query the user for an attribute value using the input command.
Store the attribute and value in the dictionary using the attribute as the item key and the value as the item value.
NOTE: Since attribute values could be plain text, eg backgroundcolor: BLUE, store attribute values as strings.
Display a message confirming that the attribute and value have been stored in the dictionary. Be sure to show the attribute by name and its particular value in the display message, eg:
width: have been added to the dictionary.
For menu selection d
Display a message indicating that your program is displaying the window attributes.
Display the attributes and their values on separate lines using a for loop. It should look something like this, depending on which attributes you have entered.
Displaying the window attributes.
width :
xcoord :
ycoord :
height :
Save the program as steppy
Step points
For this step, you'll implement menu selection c This requires the user to first have entered "width" and "height" attributes. Since the aspect ratio is determined by dividing the width by the height, both attributes must be converted to integers. This is where secure programming practices come into play because it's possible the user has entered something else for the values, which would generate a ValueError exception. You'll also need to check to see that width and height are in the dictionary.
Step 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