Skip to main content

CPT 200: Fundamentals of Programming Languages

    During my quest to obtain a Bachelor of Information Technology from Ashford University, my fourth class was CPT 200: Fundamentals of Programming Languages.  For that class, the programming language that is taught is Python 3.
    On the first week of class, we were asked to create code that would ask a user to input several pieces of information about any specific employee.  We were to use the variables: employeeName, employeeSSN, employeePhone, employeeEmail, and employeeSalary.  After the data was inputted, it needed to be printed on the screen.  Below was what I turned in for Functionality 1:


    During the second week of class, we were to read two chapters: Chapter 3: Types and Chapter 4: Branching.  These chapters introduced us to the different types of variables that can be used within Python as well as how to use branching in your scripts.
For the second functionality, we were instructed to adjust our code to allow for 5 different employees to be input into the system.  For this functionality, I decided to go above and beyond and instead ask the user how many employees they wanted to enter.  Below is the code that I submitted for week 2:
     On week 3, we followed the same pattern and were assigned two more chapters: Chapter 5: Loops and Chapter 6: Functions.  I was excited to get to this point in the book because I already had a basic understanding of functions from previous programming courses.  Once I was able to learn and grasp the Python syntax for functions, I started to program in a flurry.  I added lots of different functions to my script so that I was able to create menus and make my program modular.
    For the assigned functionality during week 3, we were instructed to add two more functions: 'Add Employee" and "View All Employees."  We were also asked to code a global variable that would create a counter to track the number of employees in the system.  That seemed like a very inefficient way to track the number of employees, and so I used the global variable to instead allow the use of my menuSelection variable within the different functions, as well as in the body of the main code.  I decided to track the number of employees by measuring the length of the dictionary where the information was being stored.  Because we learned about functions this week, my code became too complex to take screenshots.  I will include further functionalities code as their own posts.
    Week 4 allowed us to learn Chapter 7: Strings and Chapter 8: Lists and Dictionaries.  These two chapters explained more about the different methods that strings and dictionaries can use, as well as different methods to format strings.  It allowed me to start understanding how to make my script more visually appealing.
    During week 4 we were assigned two new functionalities to be added to our Employee Management System.  The new functions were: Search Employee by SSN and Edit Employee Information; we were also instructed to further refine our "View All Employees" function.  After learning about functions, my code became too large picture with a screenshot.
    On week 5 we read Chapter 9: Exceptions and Chapter 10: Files.  I was really looking forward to chapter 10 because I wanted to experiment with the different methods to use while reading and writing to files.  The book first covered using a text file to store information.  Because I already have a little experience, I knew that I was going to be able to use a CSV file to store my data.  Chapter 10 discussed how to import the CSV library and some of the basic functionality of using CSVs with Python.  Chapter 9 explained some of the different Exceptions that can be thrown while using the try-except blocks.  It also described how to use the exceptions to run additional lines of code for alerting users of an error or attempting a different process when data is found missing.  We were also instructed to combine all of the functionalities from previous assignments into one complete script.  After some troubleshooting, I was able to turn in a beautiful project that was not a 100% complete program but still more than I thought I would turn in at the beginning of the class.









Comments

Popular posts from this blog

CPT 200: Employee Management System Final Project

import sys import csv employeeList = {} employeeImport = {} lstMenuOption = ('1', '2', '3', '4', 'Q') edtMenuOption = ('1', '2', '3', '4', '5', 'Q') validation = False #initialize validation check to "False" menuSelection = None numEmployees = None num = 1 def cls():     print('\n'*50)     def main_menu():     totalEmployees = len(employeeList) #Display number of employees in the databse     print('{:~^79}'.format('~'))     print('{:~^79}'.format('                              '))     print('{:~^79}'.format('  Employee Management System  '))     print('{:~^79}'.format('          James Hardy         '))     print('{:~^79}'.format('                              '))     print('{:~^79}'.format('~'))     print(' ')     print('{:^79}'.format('There are (%d) employees in the

CPT 200: Functionality 3 - Loops and Functions

import sys employeeList = {} lstMenuOption = ('1', '2', '3', 'Q') #i = 0 #loop count variable validation = False #initialize validation check to "False" menuSelection = None numEmployees = None num = 1 def main_menu():     print('-----------------------------------------------------')     print('(1) Add new employee(s)')     print('(2) View all employees in the database')     print("(3) Check employee's information")     print('(Q) Exit\n')     totalEmployees = len(employeeList) #Display number of employees in the databse     print('There are (%d) in the database' % totalEmployees)     print('-----------------------------------------------------')     option = input('Please select an option from the menu: ')     return option def valid(option): #Function to validate menu selection     if (option.isnumeric() == True):         if option in lstMenuOption:             return True