Welcome to Assignments Writing

Your Trusted Partner in Term Paper Writing

At Assignments Writing, we’re a team of passionate educators and skilled writers committed to supporting students in their academic journey.

yearlyBalance that uses a given interest rate, balance, and term to output a table of adjusted balances each year for the number of years specified by the term. For this lab you will use a simplified formula: interest = balance * rate / 100.0;

yearlyBalance that uses a given interest rate, balance, and term to output a table of adjusted balances each year for the number of years specified by the term. For this lab you will use a simplified formula:

interest = balance * rate / 100.0;

ANSWER

To create the yearlyBalance procedure in assembly language, you’ll need to follow these steps:

  1. Create a file named balances.asm to define the yearlyBalance procedure.
  2. In the balances.asm file, define the yearlyBalance procedure according to your requirements.
  3. Create a separate file named main.asm to read user input and call the yearlyBalance procedure.
  4. In the main.asm file, include the necessary code to read user input and call the yearlyBalance procedure.
  5. Assemble both balances.asm and main.asm into an executable program.

Here’s an example implementation in x86 assembly language (assuming you’re using the x86 architecture and NASM assembler):

balances.asm:

assembly
section .text
global yearlyBalance

yearlyBalance:
; Inputs:
; - [esp+4]: Initial balance
; - [esp+8]: Interest rate (float)
; - [esp+12]: Number of years
; Output:
; - Print the adjusted balances each year

push ebp
mov ebp, esp

; Load initial values
fld dword [ebp + 8] ; Load balance onto FPU stack
fild dword [ebp + 12] ; Load the number of years as an integer
fdiv ; Divide balance by years

; Loop through the years
mov eax, 1 ; Initialize the year counter
jmp startLoop

loopBegin:
fld dword [ebp + 8] ; Reload balance onto FPU stack
fmul ; Multiply balance by rate
fdiv dword [ebp + 16] ; Divide by 100.0
fadd ; Add interest to balance

startLoop:
; Print the result
push eax
push ebx
push ecx
push edx
pushf

mov eax, 4 ; syscall number for sys_write
mov ebx, 1 ; file descriptor (stdout)
mov ecx, esp ; pointer to the string to print
mov edx, 16 ; length of the string

mov edx, eax
fwait
fstp qword [esp]
mov eax, 1
mov ebx, 0
int 80h

popf
pop edx
pop ecx
pop ebx
pop eax

; Increment the year counter
inc eax
cmp eax, dword [ebp + 12] ; Compare with the number of years
jle loopBegin ; Jump back to the beginning of the loop if not done

; Clean up and return
pop ebp
ret

main.asm:

assembly
section .data
prompt_balance db "Enter your balance: ", 0
prompt_rate db "Enter the interest rate (like 5.0): ", 0
prompt_years db "Enter the number of years: ", 0
output_format db "Year: %d: $%.2f", 10, 0

section .bss
balance resq 1
rate resq 1
years resq 1

section .text
global _start
extern yearlyBalance

_start:
; Read initial balance
mov eax, 4
mov ebx, 1
mov ecx, prompt_balance
mov edx, 26
int 80h

mov eax, 3
mov ebx, 0
mov ecx, balance
mov edx, 8
int 80h

; Read interest rate
mov eax, 4
mov ebx, 1
mov ecx, prompt_rate
mov edx, 31
int 80h

mov eax, 3
mov ebx, 0
mov ecx, rate
mov edx, 8
int 80h

; Read number of years
mov eax, 4
mov ebx, 1
mov ecx, prompt_years
mov edx, 24
int 80h

mov eax, 3
mov ebx, 0
mov ecx, years
mov edx, 8
int 80h

; Call yearlyBalance procedure
fld dword [balance]
fld dword [rate]
fld dword [years]
call yearlyBalance

; Exit the program
mov eax, 1
mov ebx, 0
int 80h

To assemble and link these files, you can use the following commands (assuming you’re on a Linux system):

bash
nasm -f elf balances.asm -o balances.o
nasm -f elf main.asm -o main.o
ld -m elf_i386 -s -o yearly_balance main.o balances.o

This will create an executable file named yearly_balance. When you run it, it will prompt you for input and then display the adjusted balances for each year.

 yearlyBalance that uses a given interest rate, balance, and term to output a table of adjusted balances each year for the number of years specified by the term. For this lab you will use a simplified formula:

interest = balance * rate / 100.0;

QUESTION

Description

 

 

Create a procedure called yearlyBalance that uses a given interest rate, balance, and term to output a table of adjusted balances each year for the number of years specified by the term. For this lab you will use a simplified formula:

interest = balance * rate / 100.0;

Pass the initial balance and rate and number of years to the procedure on the floating point  stack. Then, using a for loop output the table.  Basically you want to add the interest to the balance each year (each time through the loop)

Required:

The yearlyBalance procedure must be in a separate asm file called balances.asm. This means you should have main.asm and balances.asm. You can format these as you normally do and paste them one after the other in the submissions box.

The following shows an example output:

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 . . .

Place Your Order Here

Our Service Charter


1. Professional & Expert Writers: We only hire the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of master’s and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. We are known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: We have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

Format & Features

Our Advantages

How It Works

1. Fill Order Form
2. Make payment
3. Writing process
4. Download paper

Fill in the order form and submit all your files, including instructions, rubrics, and other information given to you by your instructor.

Once you complete filling the forms, complete your payment. We will get the order and assign it to a writer.

When your order is completed, it’s assigned to an editor for approval. The editor approves the order.

Once approved, we will upload the order to your account for you to download.  You can rate your writer or give your customer review.

What Clients Said

{

I am very satisfied! thank you for the quick turnaround. I am very satisfied! thank you for the quick turnaround.I am very satisfied! thank you for the quick turnaround.

5
Mercy M
{

I am very satisfied! thank you for the quick turnaround. I am very satisfied! thank you for the quick turnaround.I am very satisfied! thank you for the quick turnaround.

5
Jane L
{

I am very satisfied! thank you for the quick turnaround. I am very satisfied! thank you for the quick turnaround.I am very satisfied! thank you for the quick turnaround.

4.5
Rayan M

LET US DELIVER YOUR ACADEMIC PAPER ON TIME!

We are a freelance academic writing company geared towards provision of high quality academic papers to students worldwide.

Open chat
1
Scan the code
Hello
Can we help you?