```
PROCEDURE OfficeManagement
CLEAR
DO WHILE .T.
? "Welcome to the Office Management program."
? "What would you like to do?"
? "1. Add a new employee"
? "2. View employee details"
? "3. Update employee details"
? "4. Delete employee"
? "5. Exit"
? "Enter your choice (1-5): "
nChoice = VAL(INPUT(1))
IF nChoice = 1
AddEmployee()
ELSEIF nChoice = 2
ViewEmployeeDetails()
ELSEIF nChoice = 3
UpdateEmployeeDetails()
ELSEIF nChoice = 4
DeleteEmployee()
ELSEIF nChoice = 5
? "Exiting the program..."
EXIT
ELSE
? "Invalid choice. Please try again."
ENDIF
ENDDO
RETURN
PROCEDURE AddEmployee
? "Enter employee details:"
? "Name: "
cName = INPUT(50) && Assuming maximum length of 50 characters
? "Age: "
nAge = VAL(INPUT(3)) && Assuming maximum age of 999
? "Department: "
cDepartment = INPUT(20) && Assuming maximum length of 20 characters
APPEND BLANK
REPLACE Name WITH cName, Age WITH nAge, Department WITH cDepartment
? "Employee added successfully."
RETURN
PROCEDURE ViewEmployeeDetails
? "Enter the employee name to view details: "
cSearchName = INPUT(50) && Assuming maximum length of 50 characters
LOCATE FOR Name = cSearchName
IF FOUND()
? "Employee details:"
? "Name: " + Name
? "Age: " + TRANSFORM(Age)
? "Department: " + Department
ELSE
? "Employee not found."
ENDIF
RETURN
PROCEDURE UpdateEmployeeDetails
? "Enter the employee name to update details: "
cSearchName = INPUT(50) && Assuming maximum length of 50 characters
LOCATE FOR Name = cSearchName
IF FOUND()
? "Enter updated employee details:"
? "Name: "
cName = INPUT(50)
? "Age: "
nAge = VAL(INPUT(3))
? "Department: "
cDepartment = INPUT(20)
REPLACE Name WITH cName, Age WITH nAge, Department WITH cDepartment
? "Employee details updated successfully."
ELSE
? "Employee not found."
ENDIF
RETURN
PROCEDURE DeleteEmployee
? "Enter the employee name to delete: "
cSearchName = INPUT(50) && Assuming maximum length of 50 characters
LOCATE FOR Name = cSearchName
IF FOUND()
DELETE
? "Employee deleted successfully."
ELSE
? "Employee not found."
ENDIF
RETURN
OfficeManagement()
```
This program allows the user to manage employees by adding, viewing, updating, and deleting their details. It keeps running until the user selects the exit option.
Is there anything specific you would like to discuss further or any other assistance you need?
Answered by Free Powerful Ask ChatAI