Question
Program #2 section .data prompt_cookies db Enter the number of cookies you ate: total_calories_msg db Total number of calories consumed: section .bss cookies
Program #2 section .data prompt_cookies db "Enter the number of cookies you ate: " total_calories_msg db "Total number of calories consumed: "
section .bss cookies resb 5 total_calories resb 10
section .text global _start
_start: ; Prompt the user to input the number of cookies they ate mov eax, 4 mov ebx, 1 mov ecx, prompt_cookies mov edx, 34 int 0x80
; Read the user's input and store it in the cookies variable mov eax, 3 mov ebx, 0 mov ecx, cookies mov edx, 5 int 0x80
; Calculate the total number of calories consumed mov eax, [cookies] mov ebx, cookies_per_bag div ebx mov ebx, servings_per_bag mul ebx mov ebx, calories_per_serving mul ebx mov [total_calories], eax
; Display the total number of calories consumed mov eax, 4 mov ebx, 1 mov ecx, total_calories_msg mov edx, 28 int 0x80
mov eax, 4 mov ebx, 1 mov ecx, total_calories mov edx, 10 int 0x80
; Exit the program mov eax, 1 xor ebx, ebx int 0x80
Program #3
Program #3 section .data prompt_rent db "Enter your monthly rent or mortgage payment: " prompt_utilities db "Enter your monthly utility costs: " prompt_phones db "Enter your monthly phone costs: " prompt_cable db "Enter your monthly cable costs: " total_monthly_msg db "Your total monthly housing-related expenses are: $" total_annual_msg db "Your total annual housing-related expenses are: $" cookies_per_bag equ 30 servings_per_bag equ 10 calories_per_serving equ 240
section .bss rent resb 5 utilities resb 5 phones resb 5 cable resb 5 total_monthly resb 10 total_annual resb 10 cookies resb 5
section .text global _start
_start: ; Prompt the user to input their monthly rent or mortgage payment mov eax, 4 mov ebx, 1 mov ecx, prompt_rent mov edx, 38 int 0x80
; Read the user's input and store it in the rent variable mov eax, 3 mov ebx, 0 mov ecx, rent mov edx, 5 int 0x80
; Prompt the user to input their monthly utility costs mov eax, 4 mov ebx, 1 mov ecx, prompt_utilities mov edx, 34 int 0x80
; Read the user's input and store it in the utilities variable mov eax, 3 mov ebx, 0 mov ecx, utilities mov edx, 5 int 0x80
; Prompt the user to input their monthly phone costs mov eax, 4 mov ebx, 1 mov ecx, prompt_phones mov edx, 32 int 0x80
; Read the user's input and store it in the phones variable mov eax, 3 mov ebx, 0 mov ecx, phones mov edx, 5 int 0x80
; Prompt the user to input their monthly cable costs mov eax, 4 mov ebx, 1 mov ecx, prompt_cable mov edx, 32 int 0x80
; Read the user's input and store it in the cable variable mov eax, 3 mov ebx, 0 mov ecx, cable mov edx, 5 int 0x80
; Calculate the total monthly cost of housing-related expenses mov eax, [rent] add eax, [utilities] add eax, [phones] add eax, [cable] mov [total_monthly], eax
; Calculate the total annual cost of housing-related expenses mov eax, [total_monthly] mov ebx, 12 mul ebx mov [total_annual], eax
; Display the total monthly cost of housing-related expenses mov eax, 4 mov ebx, 1 mov ecx, total_monthly_msg mov edx, 42 int 0x80
mov eax, 4 mov ebx, 1 mov ecx
THESE ARE IN ASEMBLY LANGUAGE PLEASE RUN THESE PROGRAMS FOR ME AND FIX ANY ISSUE AND PROVIDE ME WITH SCREENSHOT OF OUTPUT
MAKE SURE TO UPLOAD THE SCREENSHOT OF OUTPUT OR I WILL GIVE THUMBS DOWN
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started