xerreck 0 Newbie Poster

Hey everyone this is a Assembly program I am working on and I and almost finished. I have just having a little problem doing some arithmetic, I need to calculate (0.14 * Difference) then add it to the base salary. Details are in a comment in the program code. Here is the program:

//Danny Curro
//Program to Calculate person pay

program CalcPay;
#include("stdlib.hhf")

static
		input:		int32 := 0;
		eName:		string;
		wBase:		int32 := 1200;
		gBase:		int32 := 2311;
		tBase:		int32 := 565;
		wachBase:	int32 := 852;
		dBase:		int32 := 309;
		baseSalary:	int32 := 500;
		amount:		int32 := 0;
		widAmount:	real32 := 0.14;
		gAmount:	real32 := 0.11;
		tAmount:	real32 := 0.56;
		wAmount:	real32 := 0.45;
		dAmount:	real32 := 0.97;
		difference:	int32 := 0;
		salaryDiff:	real32 := 0;
		salary:		real32 := 0;
begin CalcPay;

	stralloc(22);	//Allocate storage for sting
	mov(eax, eName); //pointer into the string variable

	stdout.put(nl, nl, nl, nl, nl);
	stdout.put("Please Enter Employee's Name: ");
	stdin.flushInput();
	stdin.gets(eName);
	
	//Display menu
	stdout.put(nl, nl, nl);
	stdout.put("------Select Product------", nl);
	stdout.put("________________________________", nl);
	stdout.put("Widgets:		1", nl);
	stdout.put("Gadgets:		2", nl);
	stdout.put("Thingamajigs		3", nl);
	stdout.put("Wachamacallits		4", nl);
	stdout.put("Dohickeys		5", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl);
	stdout.put("Please Enter Product Code[Entering 0 Will Exit Program]: ");
	stdin.flushInput();
	stdin.get(input);
	
if(input = 1) then
	


	stdout.put(nl, nl, nl);
	stdout.put("--You Have Selected--", nl);
	stdout.put("-------Widgets-------", nl, nl);
	stdout.put("Please Enter Amount Contsructed[Enter Negative Number To Exit]: ");
	stdin.flushInput();
	stdin.get(amount);

	if(amount < 0) then

	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
	elseif(amount > 0) then

	//Calculate the Difference
	mov(amount, ebx);
	sub(wBase, ebx);
	mov(ebx, difference);
	
	//CALCULATE TOTAL SALARY
	// (difference * widAmount)= salaryDiff
	// salaryDiff + baseSalary = Salary


	stdout.put(nl, nl, nl, "------Widgets------", nl);
	stdout.put("________________________________", nl);
	stdout.put("Employees Name is: ", eName, nl)
	stdout.put("The Base Amount is: ", wBase, nl);
	stdout.put("The Amount Constructed is: ", amount, nl);
	stdout.put("The Difference is: ", difference, nl);
	stdout.put("The Base Salary is: ", "$", baseSalary, nl);
	stdout.put("The Total Salary is: ", "$", nl);
	stdout.put("________________________________", nl, nl);
	
	endif;


	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);

	

elseif(input = 2) then
	stdout.put(nl, nl, nl);
	stdout.put("--You Have Selected--", nl);
	stdout.put("-------Gadgets-------", nl, nl);
	stdout.put("Please Enter Amount Contsructed[Enter Negative Number To Exit]: ");
	stdin.flushInput();
	stdin.get(amount);

	if(amount < 0) then

	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
	elseif(amount > 0) then


	mov(amount, ebx);
	sub(gBase, ebx);
	mov(ebx, difference);
	stdout.put(nl, nl, nl, "-------Gadgets-------", nl);
	stdout.put("________________________________", nl);
	stdout.put("Employees Name is: ", eName, nl)
	stdout.put("The Base Amount is: ", gBase, nl);
	stdout.put("The Amount Constructed is: ", amount, nl);
	stdout.put("The Difference is: ", difference, nl);
	stdout.put("The Base Salary is: ", "$", baseSalary, nl);
	stdout.put("The Total Salary is: ", "$", nl);
	stdout.put("________________________________", nl);
	
	endif;

	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);

elseif(input = 3) then
	stdout.put(nl, nl, nl);
	stdout.put("---You Have Selected---", nl);
	stdout.put("------Thingamajigs-----", nl, nl);
	stdout.put("Please Enter Amount Contsructed[Enter Negative Number To Exit]: ");
	stdin.flushInput();
	stdin.get(amount);


	if(amount < 0) then

	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
	elseif(amount > 0) then


	mov(amount, ebx);
	sub(tBase, ebx);
	mov(ebx, difference);
	stdout.put(nl, nl, nl, "------Thingamajigs------", nl);
	stdout.put("________________________________", nl);
	stdout.put("Employees Name is: ", eName, nl)
	stdout.put("The Base Amount is: ", tBase, nl);
	stdout.put("The Amount Constructed is: ", amount, nl);
	stdout.put("The Difference is: ", difference, nl);
	stdout.put("The Base Salary is: ", "$", baseSalary, nl);
	stdout.put("The Total Salary is: ", "$", nl);
	stdout.put("________________________________", nl);
	
	endif;

	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);

elseif(input = 4) then
	stdout.put(nl, nl, nl);
	stdout.put("----You Have Selected----", nl);
	stdout.put("------Wachamacallits-----", nl, nl);
	stdout.put("Please Enter Amount Contsructed[Enter Negative Number To Exit]: ");
	stdin.flushInput();
	stdin.get(amount);


	if(amount < 0) then

	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
	elseif(amount > 0) then

	mov(amount, ebx);
	sub(wachBase, ebx);
	mov(ebx, difference);
	stdout.put(nl, nl, nl, "------Wachamacallits------", nl);
	stdout.put("________________________________", nl);
	stdout.put("Employees Name is: ", eName, nl)
	stdout.put("The Base Amount is: ", wachBase, nl);
	stdout.put("The Amount Constructed is: ", amount, nl);
	stdout.put("The Difference is: ", difference, nl);
	stdout.put("The Base Salary is: ", "$", baseSalary, nl);
	stdout.put("The Total Salary is: ", "$", nl);
	stdout.put("________________________________", nl);

	endif;

	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);

elseif(input = 5) then
	stdout.put(nl, nl, nl);
	stdout.put("--You Have Selected--", nl);
	stdout.put("------Dohickeys------", nl, nl);
	stdout.put("Please Enter Amount Contsructed[Enter Negative Number To Exit]: ");
	stdin.flushInput();
	stdin.get(amount);



	if(amount < 0) then

	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
	elseif(amount > 0) then	

	mov(amount, ebx);
	sub(dBase, ebx);
	mov(ebx, difference);
	stdout.put(nl, nl, nl, "------Dohickeys------", nl, nl);
	stdout.put("Employees Name is: ", eName, nl)
	stdout.put("The Base Amount is: ", dBase, nl);
	stdout.put("The Amount Constructed is: ", amount, nl);
	stdout.put("The Difference is: ", difference, nl);
	stdout.put("The Base Salary is: ", "$", baseSalary, nl);
	stdout.put("The Total Salary is: ", "$", nl);
	
	endif;

	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);

elseif(input = 0) then
	stdout.put(nl, nl, nl, nl);
	stdout.put("________________________________", nl, nl);
	stdout.put("-----Thank You For Using-----", nl, nl);
	stdout.put("-----------CalcPay-----------", nl, nl);
	stdout.put("-------Have A Nice Day-------", nl);
	stdout.put("________________________________", nl);
	stdout.put(nl, nl, nl, nl);
	
endif;

	
	
end CalcPay;

I think I need to use floating point arithmetic and I am just a little confused on how to use it. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.