Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The output to my code is not outputting correctly. It needs to look like this. Enter your balance 1 0 0 0 Enter the interest

The output to my code is not outputting correctly. It needs to look like this. Enter your balance
1000
Enter the interest rate (like 5.0)
5.0
Enter the number of years
10
Year: 1: $1050.00
Year: 2: $1102.50
Year: 3 $1157.63
Year: 4: $1215.51
Year: 5: $1276.28
Year: 6: $1340.10
Year: 7: $1407.10
Year: 8: $1477.46
Year: 9: $1551.33
Year: 10: $1628.89
Press any key to continue ... I need modifications to the very code I have here: INCLUDE asmLib.inc
yearlyBalance PROTO
.data
promptBalance BYTE "Enter your balance", 0
promptRate BYTE "Enter the interest rate (like 5.0)",0
promptYears BYTE "Enter the number of years", 0
balance REAL40.0
rate REAL40.0
term DWORD 0
.code
main PROC
mov edx, OFFSET promptBalance
call writeLine
call readInt
fstp balance
mov edx, OFFSET promptRate
call writeLine
call readFloat
fstp rate
mov edx, OFFSET promptYears
call writeLine
call readInt
mov term, eax
push balance
push rate
push term
call yearlyBalance
INVOKE ExitProcess, 0
main ENDP
END main
INCLUDE asmLib.inc
.data
outputYears BYTE "Year: ",0
outCol BYTE ": ",0
dollarSign BYTE "$",0
balance DWORD 0.0
rate REAL40.0
term DWORD 0
.code
yearlyBalance PROC
mov ecx, [esp +4]
push 100
fild dword ptr[esp]
pop ebx
fld dword ptr[esp +8]
fdiv ST(0), ST(1)
fstp ST(1)
push 1
fild dword ptr [esp]
pop ebx
fadd ST(0), ST(1)
fstp ST(1)
fild dword ptr [esp +12]
mov ebx, 1
l1:
cmp ebx, ecx
jg ex
; Loop body
mov edx, offset outputYears
call writeString
mov eax, ebx
call writeInt
mov edx, offset outCol
call writeString
mov edx, offset dollarSign
call writeString
fmul st(0), st(1)
call writeFloat
endl
inc ebx
jmp l1
ex:
ret
yearlyBalance ENDP
END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions