Goal of this assignment: To be able to bring together all the leaming from the c
ID: 3835848 • Letter: G
Question
Goal of this assignment: To be able to bring together all the leaming from the course to build something substantial Project: A bank is building a new software in C. Therequirements for this software are the following: 1) There should be 2 types of accounts, an administrator account and a customer account. To start off the administrator account user must be "admin" (ogin), "admin" (password) 2) The login screen should allow both administrator and Customer to login to the system Welcome to Online Banking/ATM System Enter your customer/Admin ID: 12345 OR admin Enter your customer/Admin Password: XXXXX OR admin The administrator shall be able to login to the system. The system should detect when an administrator has logged in. Once logged in shelhe shall be able to see a menu as shown below Welcome to Online Banking/ATM System Administrator Menu 1) Create customer account 2) Change Password 3) View Customer Info 4) Change Customer Info 5) Delete Customer account 6) Show Top 5 accounts 7) Show customer accounts alphabetically 8) Exit 1) Administrator shall be able to create a customer account 2) Administrator shall be able to change his/her own password. 3) Administrator shall be able to view customer information 4) Administrator shall be able to change/edit a customer informationExplanation / Answer
data
str: .space 33
foo: .word 12
.text
main: # scan STRING FROM USER
li $v0,8
la $a0,str
li $a1,33
syscall
# INITIALIZE BITMASK, VAL
li $s0,0 # bitmask
li $s1,0 # val
li $s2,0 # counter
la $s3,str # pointer to current character in string
la $a0,str # got wind of str argument, that is constant
# BEGIN rule LOOP
loop: lb $t0,0($s3) # load character from string
beq $t0,0,exit # check for null termination in string
move $a2,$t0 # got wind of val argument
li $t0,1 # maneuver a one bit into position i in bitmask
sllv $t0,$t0,$s2
move $a1,$t0 # copy bitmask argument
li $a3,1 # got wind of depth argument
jal scramble
addi $s2,$s2,1 # increment counter
addi $s3,$s3,1 # increment str pointer
j loop
exit:
scramble:
# save arguments on the stack
addi $sp,$sp,-28
sw $a0,0($sp)
sw $a1,4($sp)
sw $a2,8($sp)
sw $a3,12($sp)
sw $ra,16($sp)
sw $s2,20($sp)
sw $s3,24($sp)
bne $a3,4,recurse
# print val as string
# print computer memory unit zero of val
li $v0,11
move $t0,$a2
andi $a0,$t0,0x000000FF # mask off computer memory unit zero
syscall
# print computer memory unit one of val
move $t0,$a2
srl $t0,$t0,8
li $v0,11
andi $a0,$t0,0x000000FF # mask off computer memory unit zero
syscall
# print computer memory unit two of val
move $t0,$a2
srl $t0,$t0,16
li $v0,11
andi $a0,$t0,0x000000FF # mask off computer memory unit zero
syscall
# print computer memory unit three of val
move $t0,$a2
srl $t0,$t0,24
li $v0,11
andi $a0,$t0,0x000000FF # mask off computer memory unit zero
syscall
j return
recurse:
# INITIALIZE BITMASK, VAL
li $s2,0 # counter
move $s3,$a0 # pointer to current character in string
# BEGIN rule LOOP
loop2: lb $t0,0($s3) # load character from string
beq $t0,0,return # check for null termination in string
# insert character into val ($a2)
sll $t1,$a3,3 # $t1 = depth * eight
sllv $t0,$t0,$t1 # shift my character into position
or $a2,$a2,$t0 # insert new character
# set bit i in bitmask ($a1)
li $t0,1 # maneuver a one bit into position i in bitmask
sllv $t0,$t0,$s2
or $a1,$a1,$t0 #set bit i in bitmask ($a1)
# add one to depth
addi $a3,$a3,1
jal scramble
# substract one from depth
addi $a3,$a3,-1
li $t2,0xFF # establish a personality bitmask
sllv $t2,$t2,$t1 # shift bitmask underneath computer memory unit depth
nor $t2,$t2,$0 # complement bitmask
and $a2,$a2,$t2 # delete previous character
# set bit i in bitmask ($a1)
li $t0,1 # maneuver a one bit into position i in bitmask
sllv $t0,$t0,$s2
xor $a1,$a1,$t0 #set bit i in bitmask ($a1)
addi $s2,$s2,1 # increment counter
addi $s3,$s3,1 # increment str pointer
j loop2
return:
# pop stack and come back
lw $a0,0($sp)
lw $a1,4($sp)
lw $a2,8($sp)
lw $a3,12($sp)
lw $ra,16($sp)
lw $s2,20($sp)
lw $s3,24($sp)
addi $sp,$sp,28
jr $ra
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.