CISC 1315 Fundamentals of Programming
Allan Kochis,Adjunct Professor - CIT


  1. Page 80 #7
    We are going to modify to read multiple employees.
    Input Processing Output

    Employee Name
    Hours Worked
    Hourly Rate
    FWT Rate
    FICA rate
    State Income Tax rate
    // Processing items
    response
    Gross
    Federal Withholding
    FICA Witholding
    State Withholding
    Net
     
    
    Start
    // 
     
    // Common processing
    Get FWT rate
    Get FICA rate
    Get State Rate
     
    // Employee processing
    DO 
       Get Employee Name
       Get Hours Worked
       Get Hourly rate
     
       Compute Gross as
           Hours Worked * Hourly Rate
       Compute Federal WithHolding as
            Gross * FWT rate
       Compute FICA WithHolding as  
            Gross * FICA rate
       Compute State Withholding as
            Gross * State rate
       Compute Net as Gross less 
            ( Federal Withholding +
              FICA WithHolding    +
              State Withholding
            )
     
       Display Pay Stub
         Employee Name
         Hours Worked
         Hourly Rate
         Gross 
         Federal WithHolding
         FICA WithHolding
         State WithHolding
         Net
     
       Prompt "Another Employee"
       Get Response
    While Reponse equal "Yes"
     
    Stop
    

    Payroll Stub for each employee
       Employee Name
       Hours Worked
       Hourly Rate
       Gross Pay
       Federal Withholding
       FICA Withholding
       State Withholding
       Net Pay

  2. Is a number prime
    Read in numbers display Prime or not prime
    Stop when number is zero
    Input Processing Output
    Number
    Processing item
       divisor
       prime (true/false)
     
    Start
     
    Get Number
     
    While Number > 0
       set divisor to 2
       set prime to true
       
       While divisor less square root of Number
             and prime is true
           If Number evenly divisible by divisor
             set prime to false
           EndIf
           add 1 to divisor
       EndWhile
           
       If prime is true
          Display Number is prime
       Otherwise   
          Display number is not prime
       EndIf
     
       Get Number
    EndWhile
     
    Stop
    
    A list of number and whether or they are prime.

  3. Is a number prime Revised
    Read in numbers display Prime or not prime
    Stop when number is zero
    Input Processing Output
    Number
    Processing item
       divisor
       prime (true/false)
     
    Start
     
    Get Number
     
    While Number > 0
       set divisor to 3
       set prime to true
     
       If Number evenly divisible by 2
            set prime to false
       EndIf
     
       While divisor less square root of Number
             and prime is true
           If Number evenly divisible by divisor
             set prime to false
           EndIf
           add 2 to divisor
       EndWhile
           
       If prime is true
          Display Number is prime
       Otherwise   
          Display number is not prime
       EndIf
     
       Get Number
    EndWhile
     
    Stop
    
    A list of number and whether or they are prime.