Adding float Numbers and Displaying them: QUICK FIX

Guys, I am trying to create an app that calculates hours for personal use but have hit a stupid snag. I am trying to multiply a set of numbers payRate*totalHours and have the sum show up under totalPay. When I click the button to calculate it the console prints 0 as the amount under the payrate. It completely ignores the code. I want to leave the totalPay and totalHours at 0 in the inspector and punch in the other stuff and have it tally up into the totals sections.

Here is my code:

public var hours: float = 0.0;

public var daysWorked: float = 0.0;
 
public var totalHours = hours * daysWorked;

public var payRate: float = 9.00;

public var totalPay: float = payRate * totalHours;


function Update()
{

//("working");

}


function OnGUI () {
	if (GUI.Button (Rect (10,10,150,100), "Hours")) 
	{
		print ("Calculating!"); 
         DisplayAmount();
         hours*=daysWorked;   
	} 
	else if(totalHours >= 1)
	{
	print("Not enough hours worked to calculate pay");
	}
	
	if (GUI.Button (Rect (10,110,150,100), "Pay")) 
	{
		print ("Calculating!"); 
        DisplayPay();
        payRate*=totalHours;
            
	}
}

        

function DisplayAmount () 
{
    Debug.Log(totalHours);
    
}

function DisplayPay () 
{
    Debug.Log(totalPay);
    
}

no sure how it works ni js but ni c# you need to do .0f or else it thinks its a double and not a float

Not sure what you meant but I tried changing the 0.0’s to 0 and nothing worked. I even tried using return but nothing worked.

Your else if says that if the totalHours is more or equal to one it can’t calculate it because not enough hours have been worked. Tried totalHours <= 1?

And your hours is set to 0. Everything multiplied by 0 is equal to 0

figured it out here is what I did