In this lab, you will practice fixing problems with a class and using dictionaries to store and use information.
You have been hired by a company that tracks the operations for various companies. They have hired you to design their program to make it modular. While some of the code is already written for you, the programmer who wrote it made some lazy mistakes. You have been tasked with fixing a few bugs that the company has found in the programmer's code.
The original programmer had been asked to design a class that represents a company. This class must keep track of:
The programmer wrote this code that represents employees and companies: company.py. Identify and fix the problems with this code. Here is a simple test program that might help you find some of the problems (there may be other problems not revealed by the program): lab09_test.py
For each problem you fix, explain why it was a problem in your assignment information sheet.
In addition to fixing the problems with the classes, create properties for the employee's name, address, and employee number; and for the company's address and employee count. At least one property must be constant.
On the programming part of the midterm, the first question asked you to convert between different measures of time. The program description is shown below. Implement this program using a dictionary.
Convert from ... | |||||
second | minute | hour | day | ||
to ... | second | 1 | 60 | 3,600 | 86,400 |
minute | 1/60 | 1 | 60 | 1,440 | |
hour | 1/3600 | 1/60 | 1 | 24 | |
day | 1/86400 | 1/3600 | 1/60 | 1 |
Display the results to two decimal places. Validate all input; ask again on invalid input.
If you wrote this program for the midterm, you may start with that version when writing this program. You may use this version shown earlier in the semester.
Complete the Assignment Information Sheet.
Submit your final program and assignment information sheet (zipped into one file) to CourseWeb in the Lab 9 assignment.
The grading rubric can be found here: Rubric (doc).
The assignment is due Monday, July 27 by 11:59 pm. As with all programming assignments, you have unlimited uploads (before the deadline), so you may upload the assignment before the deadline. If you later decide to upload another, you may do so without penalty (as long as it's before the assignment deadline). The last submission uploaded before the deadline will be the one graded. If you would like ungraded feedback on a programming assignment, you may send an email to your TA or the instructor and ask for feedback; please send your code as well.
For more advice on submitting your assignment, see the Programming Assignments section of the Tips for Success page.