Professional Documents
Culture Documents
Group 3 Documentation CC03
Group 3 Documentation CC03
Group 3 Documentation CC03
INTERMEDIATE COMPUTER
PROGRAMMING – CC03
GROUP 3
PROCESS SECTION
employees[employee_id] = {
"first_name": first_name,
"last_name": last_name,
"department": department,
"job_position": job_position,
"time_entries": {}
}
print("Employee registered successfully.")
time_entries = {}
for date in range((end_date - start_date).days + 1):
date = start_date + timedelta(days=date)
date_str = format_date(date)
if date_str is in employees[employee_id]["time_entries"]:
existing_entry = employees[employee_id]["time_entries"][date_str]
existing_time_in = existing_entry["time_in"]
existing_time_out = existing_entry["time_out"]
print("Error: Employee already timed in on " + date_str)
print("Existing Time-In: " + existing_time_in + ", Existing Time-Out: " + existing_time_out)
return
time_in = input("Enter Time-In for " + date + " (hh:mm AM/PM or A for absent): ")
time_out = input("Enter Time-Out for " + date + " (hh:mm AM/PM or A for absent): ")
if time_in is not "A" and time_out is not "A":
time_in = parse_time(time_in)
time_out = parse_time(time_out)
if time_out < time_in:
print("Time-Out cannot be before Time-In.")
return
total_hours = calculate_hours(time_out - time_in)
time_entries[date_str] = {
"time_in": format_time(time_in),
"time_out": format_time(time_out),
"total_hours": total_hours
}
else:
time_entries[date_str] = {
"time_in": time_in,
"time_out": time_out,
"total_hours": 0
}
employees[employee_id]["time_entries"].update(time_entries)
print("Timekeeping entries added successfully.")
employee_info = employees[employee_id]
print("\nEmployee Information:")
print("Employee ID: " + employee_id)
print("First Name: " + employee_info["first_name"])
print("Last Name: " + employee_info["last_name"])
print("Department: " + employee_info["department"])
print("Job Position: " + employee_info["job_position"])
print("\nTime Entries:")
for date, entry in employee_info["time_entries"].items():
print("Date: " + date + ", Time In: " + entry["time_in"] + ", Time Out: " + entry["time_out"] +
", Total Hours: " + format_hours(entry["total_hours"]))
OUTPUT SECTION
1. When the user enters a choice and press 1 and enter to proceed to the next step, it will
show what time the employee will register and after filling up the form it will show that
the employee is registered and will go back to the options. You can again press 1 to
register another employee and after filling up everything it will show the message once
again that says" Employee registered successfully".
2. _
3. When the user enters a choice and press 2 and enter to proceed to the next step, the
user needs to fill up what is needed. If you enter the time that is before your time-in the
program will say "Time-out cannot be before time-in.
4. This will be the output when you successfully filled up the necessary information
required on option 2 and there will appear a message that says " Time keeping entries
added successfully.
5. When the user enters a choice and press 3 and enter to proceed to the next step, it will
show the information about the employee and his/her time entries.
6. This image shows the personal information about the employee you are looking for but
they are yet to time-in.
7. When the user entered a number that is not register as an employee ID, a message will
show that says "Employee not found".
8. When an invalid choice is made, a message will appear that says " Invalid Choice, please
try again.".
9. This will be the output when you successfully filled up the necessary information
required on option 2 and there will appear a message that says " Time keeping entries
added successfully.
10. This will be the output when you successfully filled up the necessary information
required on option 2 and there will appear a message that says " Time keeping entries
added successfully.
11. _
12. When the user filled up wrong and unnecessary information like putting a job position
that is not in the option. There will be a message that will appear that says, "Invalid job
position" and the program will go back to the main menu.
13. When the user enters a choice and press 4 and enter, before exiting the program a
message will appear that shows the word "Exit" along with the date and time when did
you exited on the system.
14. This will be the output when you run the python program or the system of the "Time
Keeping Screen/System" that we create. It will show the options of what to press.
CONCLUTION
Creating a Python program involves a structured process that encompasses various stages from
conceptualization to execution. One of the initial challenges teams often face is defining clear
objectives and requirements. Ambiguity in project goals can lead to misinterpretations, resulting
in inefficiencies or even the development of a solution that doesn't align with actual needs. To
overcome this, teams should prioritize comprehensive discussions and documentation at the
project outset. Regular communication with stakeholders and continuous refinement of
requirements throughout the development lifecycle is crucial. It's essential to establish a robust
feedback loop to ensure everyone remains aligned and to accommodate evolving needs.
Another challenge teams encounter is managing complexity and ensuring code maintainability.
As programs grow in size and functionality, maintaining clean, understandable, and scalable
code becomes crucial. Teams may grapple with issues like code redundancy, inconsistent coding
standards, and difficulties in debugging. Employing best practices such as modular
programming, adhering to style guides, and using version control systems can alleviate these
challenges. Encouraging code reviews, fostering a collaborative environment, and organizing
regular team knowledge-sharing sessions can also enhance code quality and maintainability.
Moreover, testing and debugging pose significant challenges during the development process.
Identifying and rectifying errors, especially in larger codebases, can be time-consuming and
resource-intensive. Implementing thorough testing strategies, including unit tests, integration
tests, and regression tests, can mitigate these challenges. Additionally, utilizing debugging tools
and writing code with clear error handling mechanisms can streamline the identification and
resolution of issues. Cultivating a culture that values rigorous testing, encourages
experimentation, and embraces learning from failures fosters a proactive approach to tackling
these challenges and improving overall code quality.
APPENDICES
A.
B.
zfrom datetime import datetime, timedelta
employees = {}
def print_header(header_text):
now = datetime.now()
current_time = now.strftime("%Y-%m-%d %I:%M:%S %p")
print("=" * 40)
print(f"{header_text} - {current_time}")
print("=" * 40)
def register_employee():
print_header("Register Employee")
employee_id = input("Enter Employee ID: ")
if employee_id in employees:
print("Employee already registered.")
return
employees[employee_id] = {
"first_name": first_name,
"last_name": last_name,
"department": department,
"job_position": job_position,
"time_entries": {}
}
print("Employee registered successfully.")
def timekeeping_screen():
print_header("Timekeeping Screen")
employee_id = input("Enter Employee ID: ")
if employee_id not in employees:
print("Employee not found.")
return
time_entries = {}
for date in range((end_date - start_date).days + 1):
date = start_date + timedelta(days=date)
date_str = date.strftime('%Y-%m-%d')
if date_str in employees[employee_id]["time_entries"]:
existing_entry = employees[employee_id]["time_entries"][date_str]
existing_time_in = existing_entry["time_in"]
existing_time_out = existing_entry["time_out"]
print(f"Error: Employee already timed in on {date_str}.")
print(f"Existing Time-In: {existing_time_in}, Existing Time-Out: {existing_time_out}")
return
time_in = input(f"Enter Time-In for {date} (hh:mm AM/PM or A for absent): ")
time_out = input(f"Enter Time-Out for {date} (hh:mm AM/PM or A for absent): ")
if time_in != "A" and time_out != "A":
time_in = datetime.strptime(time_in, '%I:%M %p')
time_out = datetime.strptime(time_out, '%I:%M %p')
if time_out < time_in:
print("Time-Out cannot be before Time-In.")
return
total_hours = (time_out - time_in).total_seconds() / 3600
time_entries[date_str] = {
"time_in": time_in.strftime('%I:%M %p'),
"time_out": time_out.strftime('%I:%M %p'),
"total_hours": total_hours
}
else:
time_entries[date_str] = {
"time_in": time_in,
"time_out": time_out,
"total_hours": 0
}
employees[employee_id]["time_entries"].update(time_entries)
print("Timekeeping entries added successfully.")
def view_employee():
print_header("View Employee")
employee_id = input("Enter Employee ID: ")
if employee_id not in employees:
print("Employee not found.")
return
employee_info = employees[employee_id]
print("\nEmployee Information:")
print(f"Employee ID: {employee_id}")
print(f"First Name: {employee_info['first_name']}")
print(f"Last Name: {employee_info['last_name']}")
print(f"Department: {employee_info['department']}")
print(f"Job Position: {employee_info['job_position']}")
print("\nTime Entries:")
for date, entry in employee_info['time_entries'].items():
print(f"Date: {date}, Time In: {entry['time_in']}, Time Out: {entry['time_out']}, Total Hours:
{entry['total_hours']:.2f} hours")
def exit_screen():
print_header("Exit")
print("Thank you for using our system. Goodbye!")
while True:
print("\nWelcome to the Employee Management System!")
print("Please select an option:")
print("1. Register Employee")
print("2. Timekeeping Screen")
print("3. View Employee")
print("4. Exit")