computer science question 389
Please complete the following tasks to signify your successful completion of Unit 8. It should be the case that the only instructions you need to complete the programs assigned here are the ones I’ve described so far. Click here to see an HLA Programmer’s Reference Guide for the instructions we’ve learned so far.
Following the Electronic Submission Guidelines, please send me a copy of the .hla file you created for this assignment.
PROGRAM 5: Count Up!
Write an HLA Assembly language program that prompts for a specific int8 value named n and then displays a repeated digit pattern starting with that number. The repeated digit pattern should show all the numbers from 1 up to n and then repeat this pattern with 2 and n-2 and so on. End the looping when the starting number matches or exceeds the ending number. Shown below is a sample program dialogue.
Gimme a decimal value to use as n: 6
Here’s your number: 123456234534
Gimme a decimal value to use as n: 8
Here’s your number: 12345678234567345645
(Hint: The digit pattern is too large to store into any datatype we have learned to date so I am expecting that you will use a loop to print individual digits, rather than store the complete number in a variable.)
PROGRAM 6: Magic Number Game
Write a program that reads a magic number. Then start reading numbers, one-by-one. After each value, offer advice (higher or lower) to the player on how to win the game. If the magic number is entered, the player wins the game! If the player enters 5 numbers without entering the magic number, the player loses the game. Before the fifth number, spit out the words “Last Try!”.
Shown below is a sample program dialogue to help you build your program.
Gimme the magic number: 20
Gimme a starting number: 50
Lower
Next: 40
Lower
Next: 1
Higher
Next: 30
Lower
Next: 20
You Won The Game!
Gimme the magic number: 50
Gimme a starting number: 20
Higher
Next: 21
Higher
Next: 31
Higher
Next: 32
Higher
Last Try!
Next: 33
Sorry Charlie, You Lost The Game!
Gimme the magic number: 50
Gimme a starting number: 90
Lower
Next: 89
Lower
Next: 80
Lower
Next: 79
Lower
Last Try!
Next: 70
Sorry Charlie, You Lost The Game!
(Hint: This program is pretty complex with many different conditions to keep track of. I would recommend you write it first in C or Visual Basic and then translate your lines of code, one-by-one, into a assembly statements, just like our good friend mr. compiler does.)
