Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is assembly code please make sure to follow every single introduction please make sure to write the assembly code yourself, no plegerism please. The

this is assembly code please make sure to follow every single introduction please make sure to write the assembly code yourself, no plegerism please.
The Sorting Hat's Algorithm
While the Sorting Hat seems mysterious and powerful, it follows a basic nested If Statement. Well, this isn't really true, but it's your instructor's attempt to turn it into a programming assignment.
So, for this assignment, let's assume that it simply senses the answers to a few questions and then puts the student into the correct house (hopefully). The logic is as follows:
Examples
This is the output from one possible solution. Your solution doesn't have to look exactly like the example below. But, make sure to fulfill all the requirements. Input is displayed in blue.
Welcome to Hogwarts !
The Sorting Hat is being placed upon your head.
Do you desire to have 1. Power or 2. To be creative?
2
Do you find contentment in 1. Knowledge or 2. Friends & community?
1
Ravenclaw ! Welcome to Hogwarts!
The Sorting Hat is being placed upon your head.
Do you desire to have 1. Power or 2. To be creative?
1
Do you wish to do this for 1. Yourself or 2. Others?
2
GryEEindor
Input Validation
So, what happens if the user enters an invalid number? The Sorting Hat is going to ask the question again. So.
your program must repeat the question if they enter an invalid value. This is actually quite easy to implement,
once you understand the logic.
Welcome to Hogwarts !
The Sorting Hat is being placed upon your head.
Do you desire to have 1. Power or 2. To be creative?
3
Do you desire to have 1. Power or 2. To be creative?
-5
Do you desire to have 1. Power or 2. To be creative?
1
Question asked
Do you wish to do this for 1. Yourself or 2. Others?
again, and again
1
Slytherin! The Sorting Hat is being placed upon your head.
Repeat thequestion.
Don't restart.
Do you desire to have 1. Power or 2. To be creative?
Don't restart.
2
Do you find contentment in 1. Knowledge or 2. Friends & community?
4
Do you find contentment in 1. Knowledge or 2. Friends & community?
2
Hufflepuff!
Have Fun!
You don't have to use the four houses from Harry Potter. Create your own four categories. Naturally, the
questions will be different, but the overall approach is the same. The following are some example categories.
What class in a role player game are you?
What should you have for dinner?
What meme do you most resemble?
Which SpongeBob character are you?
Which Rick and Morty alien are you?
What kind of pet should you get - species, breed, etc...
What political philosophy are you?
What music you should listen to?
etc...Tips
Like all labs, build it in pieces. First get a single If-Statement to work. Then, you can work on to more
detailed ones.
All labels must be unique. Choose your names well.
Assembly doesn't have blocks... so don't think in those terms. Your program will be structured far
differently from programs in Java.
Requirements
Now work on each of the requirements below one at a time. You will turn in the final program, but incremental
design is best for labs. You must think of a solution on your own.
The requirements are as follows:
Display text explaining the theme of your program. You don't have create the Hogwarts one that I usec. Use
your imagination!
Input each choice (with prompts). You must input a character. Any lab that uses ScanChar will receive a
zero.
If the user enters an invalid number, repeat the question!
Implement the logic in the flowchart above. Use nested If-Statements.
Display the output for all four possibilities.
Your Task
So, for your assignment, you get to create a program to recreate the Sorting Hat.
You will ask questions and the user will respond with a character. Based on their answers, you will print which
house they will be put into.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Question

What is time-stamping, and why is it useful?

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago