Article On Steps To Building A ‘Hogwarts Zitz’ Console App That Prompts Users To Insert Data And Returns Information To The User

Article On Steps To Building A ‘Hogwarts Zitz’ Console App That Prompts Users To Insert Data And Returns Information To The User

Working with Harry Porter houses and traits

Users are prompted for their details and then I assign them their appropriate houses.

DATA TO BE INSERTED IN APP, INCLUDE

  1. Name
  2. Age
  3. Favourite color
  4. One Unique trait

LIST OF HARRY PORTER HOUSES AND TRAITS

  1. Gryffindor house (Bravery, Helping others, Chivalry)
  2. Hufflepuff house (Hardwork, Patience, Loyalty, Fairplay)
  3. Ravenclaw house (Intelligence, Knowledge, Planning ahead, Wit)
  4. Slytherin house (Ambition, Cunningness, Heritage, Resourcefulness)

STEPS TO BUILDING THE HOGWARTS ZITZ APP

STEP 1:

DECLARING THE VARIABLES

String? name = stdin. readLineSync();
String? age = stdin. readLineSync();
String? favouritecolor = stdin. readLineSync();
String? uniquetrait = stdin. readLineSync();

STEP 2:

PROMPTING USER TO INSERT DATA

print("What is your name?");
print("What is your age?");
print("What is your favourite colour?");
print("State one unique trait that you have?");

STEP 3:

SUMMARY OF USER DATA

print("Hello $name! " "You are $age years old. " "$favouritecolor is your favourite color.");

STEP 4:

USING THE IF...ELSE STATEMENT

if (uniquetrait == "Bravery" || uniquetrait == "Helping others" || uniquetrait == "Chivalry")

  {print("You belong to GRYFFINDOR house.");

  }else if(uniquetrait == "Hardwork" || uniquetrait == "Patience" || uniquetrait == "Loyalty" || uniquetrait == "Fairplay")
  {
    print("You belong to HUFFLEPUFF house.");

  } else if(uniquetrait == "Intelligence" || uniquetrait == "Knowledge" || uniquetrait == "Planning ahead" || uniquetrait == "Wit") 
  {
    print("You belong to RAVENCLAW house.");

  }else if(uniquetrait == "Ambition" || uniquetrait == "Cunningness" || uniquetrait == "Heritage" || uniquetrait == "Resourcefulness") 
  {
   print("You belong to SLYTHERIN."); 
  }  
  else
  {

    print("You do not belong to any house");
  }