﻿var degreeData = {
    thm: {
        name: 'thm',
        totalHours: 120,
        typicalHours: 12,
        calculateTuition: getMastersTuition,
        getFees: getMastersFees,
        getCostPerHour: getMastersPerHourCost,
		scholarshipAmount: 1500,
		scholarshipThreshhold: 12
    }, 
    mabc:  {
        name: 'mabs',
        totalHours: 90,
        typicalHours: 12,
        calculateTuition: getMastersTuition,
        getFees: getMastersFees,
        getCostPerHour: getMastersPerHourCost,
		scholarshipAmount: 1200,
		scholarshipThreshhold: 12
    }, 
    otherma:  {
        name: 'otherma',
        totalHours: 60,
        typicalHours: 12,
        calculateTuition: getMastersTuition,
        getFees: getMastersFees,
        getCostPerHour: getMastersPerHourCost,
		scholarshipAmount: 1000,
		scholarshipThreshhold: 12

    }, 
    mabs:  {
        name: 'mabs',
        totalHours: 60,
        typicalHours: 12,
        calculateTuition: getMastersTuition,
        getFees: getMastersFees,
        getCostPerHour: getMastersPerHourCost,
		scholarshipAmount: 500,
		scholarshipThreshhold: 12 
    }, 
    phd:  {
        name: 'phd',
        totalHours: 30,
        typicalHours: 6,
        calculateTuition: function(semester, hours) {
            return 520 * hours;
        },
        getFees: function(semester, hours) {
            return 0;
        },        
        getCostPerHour: function(semester, hours) {
            return 520;
        },
		scholarshipAmount: 1000,
		scholarshipThreshhold: 6
    }, 
    dmin:  {
        name: 'dmin',
        totalHours: 30,
        typicalHours: 9,
        calculateTuition: function(semester, hours) {
            return 585 * hours;
        },
        getFees: function(semester, hours) {
            return 20 * hours;
        },        
        getCostPerHour: function(semester, hours) {
            return 585;
        },
		scholarshipAmount: 0,
		scholarshipThreshhold: 0
    }
};

// START: INTERNAL METHODS
function getMastersTuition(semester, hours) {
    return getMastersPerHourCost(semester, hours) * hours;
}

function getMastersFees(semester, hours) {
    
    var fees = 0;
                
    if (semester == 'Summer') {
        if (hours > 0) {

            fees = 65 + // technology
                hours * 10 // summer fee
                ;  
        }

    } else {
        var fees = 
            60 + // general fall spring fee
            65 // technology
            ;
        
        if (hours >= 6)
            fees += 55;
    }
    
    return fees;
    
}
function getMastersPerHourCost(semester, hours) {
    
    if (semester == 'Summer') {
        return 385;
    } else {
        if (hours <= 4)
            return 465;
        else if (hours <=8)
            return 438;
        else if (hours <= 11)
            return 405;
        else if (hours >= 12) 
            return 375;    
    }
    
    return 0;
}
// END: INTERNAL METHODS