Group 3 Documentation CC03

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

ICCT COLLEGES CAINTA CAMPUS

INTERMEDIATE COMPUTER
PROGRAMMING – CC03
GROUP 3

Leader: Ramil Josh C. Recreo


Members: April Rose Corsino
Angelika Mariquit
Ivan Balagasay
Lienard Arrojado
Adore Jaicion Morales

Professor: Mr. Ronelle Clark Esplanada Submitted on: November 7, 2023


TABLE OF CONTENTS
I. INPUT SECTION…………………
II. PROCESS SECTION……………..
III. OUTPUT SECTION………………
IV. CONCLUSION SECTION………..
V. APENDICES……………………….
INPUT SECTION

INPUT AND VARIABLE DETAILS

Variable Name Data Type Initial Value Description


 employees  Dictionary  {}  Stores
information
about registered
employees.
 print_header  Function  Function  Prints a
formatted
header with the
provided text
and current time.
 Employee_id  Timekeeping_screen  Function  Register’s a new
 First_name employee by
 Last_name capturing their
 Department details like ID,
 Job_position name,
department, and
job position.
 Employee_id  View_employee  function  Manages
 Start_date timekeeping
 End_date entries for
 Time_antries employees
within a
specified data
range.
 While true loop  Print an exit
message when
the user chooses
to exit the
employee
management
system.
 Choice   {}  Provides a menu-
driven interface
allowing users to
register
employees,
manage,
timekeeping,
view employee’s
information, or
the system

PROCESS SECTION

employees = {} # Initialize an empty dictionary to store employee details

# Function to print header text along with the current time


function print_header(header_text):
now = get_current_time() # Fetch current date and time
current_time = format_time(now) # Format time as per the required format
print("====================")
print(header_text + " - " + current_time)
print("====================")

# Function to register a new employee


function register_employee():
print_header("Register Employee")
employee_id = input("Enter Employee ID: ")
if employee_id is in employees:
print("Employee already registered.")
return

first_name = input("Enter First Name: ")


last_name = input("Enter Last Name: ")
department = input("Enter Department (IT, HR, Finance): ")
if department is not in ["IT", "HR", "Finance"]:
print("Invalid department.")
return

job_position = input("Enter Job Position (Manager, Staff, Intern): ")


if job_position is not in ["Manager", "Staff", "Intern"]:
print("Invalid job position.")
return

employees[employee_id] = {
"first_name": first_name,
"last_name": last_name,
"department": department,
"job_position": job_position,
"time_entries": {}
}
print("Employee registered successfully.")

# Function to manage timekeeping entries for an employee


function timekeeping_screen():
print_header("Timekeeping Screen")
employee_id = input("Enter Employee ID: ")
if employee_id not in employees:
print("Employee not found.")
return

start_date = input("Enter Start Date (YYYY-MM-DD): ")


end_date = input("Enter End Date (YYYY-MM-DD): ")
if end_date < start_date:
print("End Date cannot be before Start Date.")
return

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.")

# Function to view employee information and time entries


function 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("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"]))

# Function to handle exit of the program


function exit_screen():
print_header("Exit")
print("You have successfully exited our Employee Management System!")

# Main loop to manage the Employee Management System


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")

choice = input("Enter choice (1/2/3/4): ")


if choice is "1":
register_employee()
elif choice is "2":
timekeeping_screen()
elif choice is "3":
view_employee()
elif choice is "4":
exit_screen()
break
else:
print("Invalid choice. Please try again.")

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

first_name = input("Enter First Name: ")


last_name = input("Enter Last Name: ")
department = input("Enter Department (IT, HR, Finance): ")
if department not in ["IT", "HR", "Finance"]:
print("Invalid department.")
return

job_position = input("Enter Job Position (Manager, Staff, Intern): ")


if job_position not in ["Manager", "Staff", "Intern"]:
print("Invalid job position.")
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

start_date = datetime.strptime(input("Enter Start Date (YYYY-MM-DD): "), '%Y-%m-%d')


end_date = datetime.strptime(input("Enter End Date (YYYY-MM-DD): "), '%Y-%m-%d')
if end_date < start_date:
print("End Date cannot be before Start Date.")
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")

choice = input("Enter choice (1/2/3/4): ")


if choice == "1":
register_employee()
elif choice == "2":
timekeeping_screen()
elif choice == "3":
view_employee()
elif choice == "4":
exit_screen()
break
else:
print("Invalid choice. Please try again.")

You might also like