homeWork4Que1
.asm
keyboard_arrow_up
School
San Jose State University *
*We aren’t endorsed by this school
Course
102
Subject
Computer Science
Date
Feb 20, 2024
Type
asm
Pages
2
Uploaded by GrandGrousePerson1016
.data
prompt1 : .asciiz " Enter the a value for x: " Prompt2 : .asciiz " The answer of the polynomial equation is : " prompt3 : .asciiz " Enter the power of the highest polynimial: "
newline: .asciiz "\n"
prompt : .asciiz " The value is : "
.text
main: #Displaying prompt 1 li $v0,4
la $a0,prompt1
syscall
#Taking the input from the user
li $v0, 5
syscall move $a1, $v0
#[ value of x ]
#Displaying prompt3
li $v0,4
la $a0,prompt3
syscall
#Taking the input from the user for prompt3
li $v0, 5
syscall move $a2, $v0 # [ the highest power value ]
#Exit li $v0, 10
syscall
# calling poly function
jal poly
#Start of poly function
poly: #Calling pow function
jal pow
li $v0,4
la $a0,prompt
syscall
li $v0, 1
syscall move $t2,$v0
#Start of pow function
pow :
# $a1 = x , $a2 = exponent
move $a2, $t3
li $t1,0
loop1: blez $t3,$t1, exit
move $a1, $t6
mul $t6, $t6, $t6
j loop1
jr $ra
exit:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
e variable. Express your solution as an int y-11-13 y
arrow_forward
Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 3 if user_num2 is greater than 13. Otherwise, print "user_num2 is less than or equal to 13.". End with newline.
arrow_forward
Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 9. Otherwise, print "userNum2 is less than or equal to 9.". End with newline.
C code
arrow_forward
please send step by step complete handwritten solution for Q7
arrow_forward
What will be displayed when the following code is executed?
const int x = 7;
int y = 10;
у *3 5;
у /3 4;
cout « "y = " <« y « " and x =" « x « "; " <« endl;
X -= 30;
у /3 5;
X -= 10;
x += 32;
cout <« "x = " « x « " and y = " <« y « ";" << endl;
%3D
%3D
arrow_forward
,
arrow_forward
int num1 = 10, num2 = 9, num3 = 18;
num1
arrow_forward
{ }Cϕ
true or false
arrow_forward
Please draw the correct flowchart for this game ?
# Function to display question and answer
def new_game():
guesses = []
Right_guesses = 0
question_num = 1
num = 1
for key in questions:
print("\n------------------------- \n")
print("Question " + str(num) + "\n" )
num += 1
print(key)
for i in options[question_num-1]:
print(i)
guess = input("\nAnswer (A, B, C, or D): ")
guess = guess.upper()
guesses.append(guess)
Right_guesses += check_answer(questions.get(key), guess)
question_num += 1
display_score(Right_guesses, guesses)
# -------------------------
# Function to check answer
def check_answer(answer, guess):
if answer == guess:
print("\nYour Answer Correct!")
return 1
else:
print("\nYour Answer Wrong!")
return 0
# -------------------------
# Function to display score
def display_score(Right_guesses, guesses):…
arrow_forward
Evaluate the following postfix expression.
3 7 8 * +
arrow_forward
On
F
||||
Please enter your choice: 1
1232
12343
||||
1. View all students' records
2. View a student's records by ID
2343
3423
7. Complete the following problem below in java
The program will first display a menu that enables the users to choose whether they
want to view all students 'records or view only the records of a specific student by the
student's id. See sample below.
Example:
11232
Paragraph
If the user types in for Choice 1, it displays this:
StudentID | Quiz1 | Quiz2 | Mid-Term | Final |
| 10 | 23 145
| 56 |
| 45
| 43
| 78 |
| 34
| 45
| 45 |
| 67
| 6
| 56 1
Code:
MENU
Accessibility: Unavailable
Q Search
<
| 24
| 45
| 65
If the user types in for Choice 2, it will ask the user to enter in an ID. If the user enters in
an invalid ID, the user has to keep entering one in until a correct one is entered. Once a
valid ID is entered, will display the students ID, Quiz1, Quiz2, Mid-Term, and Final
grade.
| 10 | 23
r
√5
| 45
| 56
C
18 1
Styles
O
Norma
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- e variable. Express your solution as an int y-11-13 yarrow_forwardPrint "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 3 if user_num2 is greater than 13. Otherwise, print "user_num2 is less than or equal to 13.". End with newline.arrow_forwardPrint "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 9. Otherwise, print "userNum2 is less than or equal to 9.". End with newline. C codearrow_forward
- please send step by step complete handwritten solution for Q7arrow_forwardWhat will be displayed when the following code is executed? const int x = 7; int y = 10; у *3 5; у /3 4; cout « "y = " <« y « " and x =" « x « "; " <« endl; X -= 30; у /3 5; X -= 10; x += 32; cout <« "x = " « x « " and y = " <« y « ";" << endl; %3D %3Darrow_forward,arrow_forward
- int num1 = 10, num2 = 9, num3 = 18; num1arrow_forward{ }Cϕ true or falsearrow_forwardPlease draw the correct flowchart for this game ? # Function to display question and answer def new_game(): guesses = [] Right_guesses = 0 question_num = 1 num = 1 for key in questions: print("\n------------------------- \n") print("Question " + str(num) + "\n" ) num += 1 print(key) for i in options[question_num-1]: print(i) guess = input("\nAnswer (A, B, C, or D): ") guess = guess.upper() guesses.append(guess) Right_guesses += check_answer(questions.get(key), guess) question_num += 1 display_score(Right_guesses, guesses) # ------------------------- # Function to check answer def check_answer(answer, guess): if answer == guess: print("\nYour Answer Correct!") return 1 else: print("\nYour Answer Wrong!") return 0 # ------------------------- # Function to display score def display_score(Right_guesses, guesses):…arrow_forwardEvaluate the following postfix expression. 3 7 8 * +arrow_forwardOn F |||| Please enter your choice: 1 1232 12343 |||| 1. View all students' records 2. View a student's records by ID 2343 3423 7. Complete the following problem below in java The program will first display a menu that enables the users to choose whether they want to view all students 'records or view only the records of a specific student by the student's id. See sample below. Example: 11232 Paragraph If the user types in for Choice 1, it displays this: StudentID | Quiz1 | Quiz2 | Mid-Term | Final | | 10 | 23 145 | 56 | | 45 | 43 | 78 | | 34 | 45 | 45 | | 67 | 6 | 56 1 Code: MENU Accessibility: Unavailable Q Search < | 24 | 45 | 65 If the user types in for Choice 2, it will ask the user to enter in an ID. If the user enters in an invalid ID, the user has to keep entering one in until a correct one is entered. Once a valid ID is entered, will display the students ID, Quiz1, Quiz2, Mid-Term, and Final grade. | 10 | 23 r √5 | 45 | 56 C 18 1 Styles O Normaarrow_forwardarrow_back_iosarrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT