1. Homepage
  2. Programming
  3. CS5001 Intensive Foundations of Computer Science - Homework 3: Functions, Loops, Conditions, and more Event-Driven Programming

CS5001 Intensive Foundations of Computer Science - Homework 3: Functions, Loops, Conditions, and more Event-Driven Programming

Engage in a Conversation
USNortheastern UniversityCS5001Intensive Foundations of Computer SciencePythonNEU

Homework 3: Functions, Loops, Conditions, and more Event-Driven Programming CourseNana.COM

  CourseNana.COM

Programming Problem #1: System Functions and DateTime menu CourseNana.COM

Filename: menu_driver.py , menu_functions.py CourseNana.COM

Addi#onal files: menu_flowchart.pdf , for the run_menu() function
CourseNana.COM


CourseNana.COM


For this program, write a one-line driver in menu_driver.py thatcalls the func"on run_menu() from menu_fuctions.py . The rest of your func"ons should also be in menu_functions.py .
For this program, we're going to use two libraries:
os and datetime , both of which you should import for this problem. Don't assume you can use these modules in future assignments; it's just for this one problem, to have a bit of fun with Python talking to our computer systems. CourseNana.COM

Your menu should print a list of options: CourseNana.COM

P for print the menu,
M to display the full name of the current month,
D to get the current day of the week,
T to get the local #me in 24:00:00 hours/minutes/seconds format, W to get the current working directory, and
Q to quit
(you can display this op"on, or not - your choice) CourseNana.COM

This program should run con#nuously un#l the user inputs "Q".
Any other inputs should be ignored, the user no#fied that it is not a valid op#on and the op#ons re-printed (see example for the print message in sample
CourseNana.COM

output below)
This program should demonstrate good func#on design, where each func#on does only one thing (even if that thing is simple). Sample output:
CourseNana.COM

Here is the official documenta"on for date"me: h!ps://docs.python.org/3/library/date"me.html CourseNana.COM

And here is the official documenta"on for os: h!ps://docs.python.org/3/library/os.html CourseNana.COM

Try to use Ctrl-F or Command-F (on a Mac) to search for the func"onality you're looking for. However, these are very complicated libraries! CourseNana.COM

You may find simplified tutorials for these libraries elsewhere on the web. On Piazza, feel free to share ONLY _your search terms_ with your fellow students, but please for this week let them find the actual webpages on their own. CourseNana.COM

Programming Problem #2: Event-Driven Programming and Click Capture CourseNana.COM

Filename to submit: shape_clicker.py Starter code: PositionRecord.py CourseNana.COM

Starter file: Save the image below using "save image as", and use it as your background. CourseNana.COM

This part of the homework builds on our shape drawing skills from the lab and add some and event-driven programming.
Event-driven programming is the basis of most of what your computer does, if you think about it: your computer programs mostly just sit around and don't run or change informa"on unless you click something on them. So we're going to start using this incredibly important programming paradigm here. NO FLOWCHART or TEST CASES REQUIRED this #me.
Your program should do the following:
CourseNana.COM

  1. Use the image above as your background for the turtle screen. Remember, the .png image of the applica#on window is 970x635 pixels
  2. Draw a square with a side length of 90 star#ng at (0, 0). Use green for your pen color.
  3. Register for mouse clicks
  4. When the user clicks anywhere inside the square with their mouse, erase the square. (If they click outside the square, do nothing)
  5. A$er the square has been erased, if they click anywhere on the canvas, draw the square, with the center at the (x, y) coordinates where they clicked

You can watch a demonstra#on of the expected output of the program below: CourseNana.COM

Note: You may use the Turtle/pen as a global variable. However, other than any constants you use, no variables other than the turtle should be declared in the global namespace. CourseNana.COM

Instead of using global variables, we have provided the PositionRecord code for your convenience. Import it into your program and then you can use it as a “posi"on record” that allows you to store and retrieve informa"on about your circle regarding its posi"on and visibility. PositionRecord is implemented using object-oriented programming, so you probably won’t understand the code yet. Don’t worry about that, simply use the service via these func"ons: CourseNana.COM

  CourseNana.COM


CourseNana.COM

# Purpose: record the x position . Parameter: the x coordinate you want to record. Does not # Purpose: record the y position. Parameter: the y coordinate you want to record. Does not CourseNana.COM

# Purpose: record both the x and y position. Parameter: the x coordinate you want to record and the y coordinate you want to record. Does not return anything CourseNana.COM

get_position_x() # Purpose: get the x position you've previously recorded. Parameters: none Returns: the x position previously recorded. CourseNana.COM

get_position_y() # Purpose: get the y position you've previously recorded. Parameters: none Returns: the y position previously recorded. CourseNana.COM

record_visible( visibility ) # Purpose: to record a Boolean value to indicate that you’ve hidden or displayed your shape on the canvas. This Boolean value is meant to represent whether the shape is currently visible or not. Parameters: A Boolean value. Returns: Nothing CourseNana.COM

is_shape_visible_now() # Purpose: returns a Boolean value that was previously recorded Parameters: none Returns: the Boolean value previously stored here. This Boolean value is meant to represent whether the shape is currently visible or not. CourseNana.COM

Before record_visible is called the first time, this variable returned by is_shape_visible_now() is set to True. CourseNana.COM

Important Notes: CourseNana.COM

It’s very difficult to test graphics-related func"ons without explicit test tools (screen-grabbers, func"onal test tools, etc.), so your most important job is to ensure your turtle movement and drawing is as consistent as possible.
when you move the turtle, it has a direc#onal heading (N/S/E/W). Take care to set the heading consistently to ensure repeatable drawing of the square
CourseNana.COM

record_position_x( x ) CourseNana.COM

return anything CourseNana.COM

record_position_y( y ) CourseNana.COM

return anything CourseNana.COM


CourseNana.COM

record_position(x, y) CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
US代写,Northeastern University代写,CS5001代写,Intensive Foundations of Computer Science代写,Python代写,NEU代写,US代编,Northeastern University代编,CS5001代编,Intensive Foundations of Computer Science代编,Python代编,NEU代编,US代考,Northeastern University代考,CS5001代考,Intensive Foundations of Computer Science代考,Python代考,NEU代考,UShelp,Northeastern Universityhelp,CS5001help,Intensive Foundations of Computer Sciencehelp,Pythonhelp,NEUhelp,US作业代写,Northeastern University作业代写,CS5001作业代写,Intensive Foundations of Computer Science作业代写,Python作业代写,NEU作业代写,US编程代写,Northeastern University编程代写,CS5001编程代写,Intensive Foundations of Computer Science编程代写,Python编程代写,NEU编程代写,USprogramming help,Northeastern Universityprogramming help,CS5001programming help,Intensive Foundations of Computer Scienceprogramming help,Pythonprogramming help,NEUprogramming help,USassignment help,Northeastern Universityassignment help,CS5001assignment help,Intensive Foundations of Computer Scienceassignment help,Pythonassignment help,NEUassignment help,USsolution,Northeastern Universitysolution,CS5001solution,Intensive Foundations of Computer Sciencesolution,Pythonsolution,NEUsolution,