Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Online Education (https://www.askmehelpdesk.com/forumdisplay.php?f=401)
-   -   Java script code error (https://www.askmehelpdesk.com/showthread.php?t=773802)

  • Nov 3, 2013, 06:46 PM
    kevinvigg617
    Java script code error
    I am trying to do a homework assignment and I am having issues getting the code to work. Here is the task and then my code so far. Any help would be appreciated.

    Task:
    A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales are 125% or more of their monthly goal of $90,000, then all employees will receive a message stating that they will get a day off.


    ----------

    Function main ()
    //Declare local variables
    Var real monthlySales;

    {
    GetSales(monthlySales)
    GetBonus (bonusMoney)
    GetDayoff (dayOff)
    }

    //this module takes in the required user input
    {
    Function getSales(Real Ref monthlySales)
    Display “Enter the total sales for the month.”;
    End function
    }

    //this module will determine if a bonus is awarded. If
    //sales are greater than or equal to 100000, then they
    //get a 5000 bonus
    Function getBonus(Real Ref monthlySales)
    {
    If monthlySales >=100000 Then
    Println “You get a bonus of $5,000!!!”;
    End If
    End function
    }

    //this module will determine if all employees get a day
    //off. If sales are greater than or equal to 125% of $90000,
    //then they get a day off.
    Function GetDayoff(Real Ref monthlySales)
    {
    If monthlySales >=112500 Then
    Println “ You get a bonus of $5,000!!!”;
    Println “All employees get one day off!!!”;
    End If
    End function
    }
    End main()
  • Nov 3, 2013, 07:12 PM
    kevinvigg617
    Revised code and all I get is in the display window is
    ...

    Function Main()
    Var real monthlySales;
    {
    BonusMoney = getBonus();
    Dayoff = getdayOff();
    GetSales = monthySales();
    }

    Function getSales(Real Ref monthlySales)
    {
    Return prompt("Enter the total sales for the month.");
    End function
    }

    Function getBonus(Real Ref monthlySales)
    {
    If monthlySales >=100000 Then
    Println “You get a bonus of $5,000!!!”;
    End If
    End function
    }

    Function GetDayoff(Real Ref monthlySales)
    {
    If monthlySales >=112500 Then
    Println “ You get a bonus of $5,000!!!”;
    Println “All employees get one day off!!!”;
    End If
    End function

    Main();

  • All times are GMT -7. The time now is 12:39 PM.