# Assignment 3

Type: Group Assignment

## Prologue

This is a group assignment. Remember that you should always be working with your partner. You may NOT divide up the work and complete the parts independently. All work you submit must be fully authored by both you and your partner.

## Part 1: Code of Conduct

Much of this course is filled with activities and assignments that you must complete with a partner, and history has shown that it is useful to have a Code of Conduct that is tailored to our class. The goal of such a code of conduct is to ensure that these partnerships are effective and help cultivate a friendly environment that facilitates the learning in this course.

Your task for this problem is to write a one page code of conduct proposal that you think would be a good policy to adopt for our class. The key elements and themes from everyone’s submissions will then be combined into a single Code of Conduct policy for our course.

Warning! Parts of your proposal may be shared with the class and discussed in a large group, so be prepared to defend your proposal to your classmates.

You should begin by discussing your takeaways from Stuart Wray’s How Pair Programming Really Works article

### Driver/Navigator Metaphor

In his article, Wray primarily discusses pair programming in which two people sit at one computer and each have different roles. Here is what he writes (emphasis mine):

In this metaphor, the driver controls the keyboard and focuses on the immediate task of coding, and the navigator acts as a reviewer, observing and thinking about more strategic architectural issues.

If you argue that we should use the driver/navigator method, your recommendation should at least answer the following questions:

1. What are the primary responsibilities of the driver?
2. What are the primary responsibilities of the navigator?
3. What guidelines do you suggest that would make the driver/navigator method as effective as possible?

If you argue that we should NOT use the driver/navigator method, you must provide an alternative approach to working in a pair. Just as working on a team in industry will be unavoidable, you may not recommend that we drop the group work in this course. Your recommendation must also adhere to our Academic Integrity Policy.

### General Behavioral Guidelines

Your proposal should also include suggestions for general behavioral guidelines to make working in a group successful. For example, you may specify guidelines that are related to communication, meetings, and mutual respect.

### Consequences for Violations

Finally, your code of conduct should describe what consequences the instructor should apply to students who violate the guidelines in your proposal. Here are a few scenarios to help guide you through this process.

Scenario 1
A student doesn’t show up to meetings, or comes to meetings unprepared, or ignores their partner during meetings and expects their partner to complete the work and explain it to them.
Scenario 2
A student is disrespectful, doesn’t want to work with their partner, completes the assignment independently, and submits the assignment as if they completed it as a team.

Format: Please put your proposal in a plain text file named code_of_conduct.txt or a PDF document named code_of_conduct.pdf.

## Part 2: Python Programming

### Problem 1: Whatzitdo?

Sometimes programmers write programs that are difficult to read. Let’s take a look at the following program.

# Author:
#   Titus Klinge
def main():
print("This program does something.")
apple = input()
orange = input()
banana = input()
salad = (int(apple) + int(banana) + 2*int(orange))

main()


a. Create a new file mystery_solved.py and copy the code into it.

b. Add yourselves as authors to the program at the top.

c. Determine what the program is doing and modify the first print statement of the file so that it accurately communicates what the program is doing to the user.

d. The variable names apple, orange, banana, and salad aren’t very helpful. Give them names that are more descriptive of what they are.

e. Change the program so that it prints a helpful message to the user about what the program is doing before it prompts them to type in the three inputs.

f. Notice that the int() function is being called an excessive number of times. Modify the code so that it only calls int() three times.

g. Think again about what the program is doing. Are there any unnecessary steps in the computation of the output? If so, remove them.

### Problem 2: Voting Year

Write a Python program in a file named voter.py that asks the user what year they were born and then prints the first U.S. presidential election year that they can vote in. This is a bit trickier since the user needs to be at least 18 to vote and presidential elections only happen on years that are divisible by four. (For simplicity, you may assume that the user of your program was born before November.)

What year were you born? 2000
You can vote in the 2020 presidential election.


Warning! For this problem, you are not allowed to use conditionals or loops to solve this problem! Below demonstrates a trick idea that allows you to compute the decade someone was born in. You will need to do something similar in your voter.py solution.

import math
birth_year = 1996
print("You were born in the " + str(decade) + "0s.")


## How to Turn in Your Code

1. Once you are finished with the assignment, you should go to https://codepost.io and log into your account.
2. Go to the CS 65 course.