Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

this cannot run in mars Lab Work In this task you are required to write a program for asking the basic information from the user.

image text in transcribed
image text in transcribed
image text in transcribed
this cannot run in mars
Lab Work In this task you are required to write a program for asking the basic information from the user. In this program, the user is required to input his/her name and age (the sample input is as shown in bold). Your program is required to output a greeting to the user and display his/her name and age. Sample Output Please enter your nickname: Jeff Please enter your surname: AuYeung Jeff AuYeung How old are you? 18 You are 18 years old. Program Skeleton You may start your program by using the following skeleton, and comments must be included to describe the functions that you have performed. E.g. # Print a new line, # read a string, etc. # NAME: # Student ID: # CCIT4026 Computer Organization # Lab2 # Input and Output #-----Data Segment --- .data - Text Segment .text .globl start -start: # -- - # Write your code here # Terminate the program (3) Save the file as lab2.asm (4) Assemble the program by clicking Run -> Assemble (5) Run the program by clicking Run -> Go .data #Section that declares variables for program first Prompt String: .asciiz "Please enter your nickname: " second PromptString: . asciiz "Please enter your surname: " name: .space 20 firstOutString: secondoutString: .asciiz .asciiz thirdpromptString: asciiz "how old are you: ?" thirdoutString: asciiz "you are years old." .text #Section that declares methods for program main: #Printing string asking for a name la Sal, first Prompt String #address of the string to print li $v0, 4 #Loads system call code for printing a string into $v0 so syscall can execute it syscall #call to print the prompt. register $v0 will have what syscall is, $a0-$a 3 contain #Prompting user for response and storing response li $v0, 8 #System call code for reading a string syscall SW $v0, name li $v0, 4 #System call code for printing a string la $a0, $v0) #address of the string to print syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions