• Task: Create a program that behaves as follows:

•  Task:
Create
a
program
that
behaves
as
follows:
1.  Display
a
prompt
“Is
CMPE12
the
coolest
[y/n]?”
2.  Get
user
input
a. 
b. 
c. 
d. 
If
user
input
is
‘x’
then
display
a
prompt
and
exit
If
user
input
is
‘y’
then
display
a
prompt
and
go
to
1.
If
user
input
is
‘n’
then
display
a
prompt
and
go
to
1.
Anything
else,
go
to
1
Flow
Chart
Start
Display
Prompt
GETC
END
Is
input
‘x’?
Y
Is
input
‘y’?
Y
Is
input
‘n’?
Y
Display
Prompt
N
Display
Prompt
N
Display
Prompt
N
Display
Prompt
Pseudocode
1. 
2. 
3. 
4. 
5. 
6. 
Display
“Is
CMPE12
the
coolest
[y/n]?”
Get
input.
If
input
==
‘x’,
then
print
“Whatevs!”
and
exit
program.
Else
if
input
==
‘y’
then
print
“Hell
yeah!”
and
go
to
1.
Else
if
input
==
‘n’
then
print
“Nope!
Nope!”
and
go
to
1.
Else
input
is
invalid
so
print
“Invalid”
and
go
to
1.
Pseudocode:
Is
input
==
‘x’
Then
exit
Else
check
for
‘y’
LC‐3:
;
Assume
user
input
is
in
R0
LD
ADD
BRz
R1,
NegX
R1,
R1,
R0
Done ;
R1
=
‘x’
;
change
CC
;
check
if
x
CheckY: ;
else
check
for
y
;
code
for
checking
‘y’
goes
here
Done: LEA
R0,
P1
PUTS ;
display
prompt
HALT ;
exit
NegX .fill ‐120
P1 .stringz “Whatevs!”
Pseudocode:
Is
input
==
‘y’
Then
prompt
and
go
to
1
Else
check
for
‘n’
LC‐3:
;
Assume
user
input
is
in
R0
LD
ADD
BRz
R1,
NegY
R1,
R1,
R0
isYes ;
R1
=
‘y’
;
change
CC
;
check
if
y
CheckN:
;
else
check
for
n
;
code
for
checking
‘n’
goes
here
isYes: LEA
R0,
P2
PUTS ;
display
prompt
BR Start ;
go
to
1
;
more
code
here
HALT
NegY .fill ‐121
P2 .stringz “Hell
yeah!”
Pseudocode:
Is
input
==
‘n’
LC‐3:
;
Assume
user
input
is
in
R0
LD
R1,
NegN ;
R1
=
‘n’
Then
prompt
and
go
to
1
ADD
R1,
R1,
R0 ;
change
CC
Else
display
another
BRz
isNo
;
check
if
‘n’
Invalid: ;
else
invalid
input
prompt
and
go
to
1
LEA
R0,
P3
PUTS ;
display
prompt
BR Start ;
go
to
1
isNo: LEA
R0,
P4
PUTS ;
display
prompt
BR Start ;
go
to
1
;
more
code
here
HALT
NegN .fill ‐110
P3 .stringz “Invalid!”
P4 .stringz “Nope!
Nope!”