Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the second part of this assignment, you will ask the user to input positive integers for four personality aspects: bravery, loyalty, intelligence, and cunning.

image text in transcribed
For the second part of this assignment, you will ask the user to input positive integers for four personality aspects: bravery, loyalty, intelligence, and cunning. As you might have guessed, these aspects correspond to Gryffindor, Hufflepuff, Ravenclaw, and Slytherin, respectively. You may assume that the user will always input a positive integer for these aspects. The formulae for calculating the percent matches is: Gryffindor = Bravery/Total; Hufflepuff = Loyalty/Total; Ravenclaw = Intelligence/Total: Slytherin-Cunning/Total During display, each percentage should be rounded to two decimal points (see the appendix for how to use setprecision and fixed). Next, you will store the name of the highest matching house in a variable. The user's final house will be the one that has the highest input value. If there is a tie between two or more houses, choose the house that comes first in the list above. At the end, your program should print out the user's pet choice and their house. SAMPLE OUTPUT Now we must sort you into a House. For each category, please enter a positive integer The highest integer will determine which house you are sorted into Bravery: 30 Loyalty: 8000 Intelligence: 1 Cunning: 123 You are: 0.37% Gryffindor 98.11% Hufflepuff 0.01% Ravenclaw 1.51% Slytherin Congratulations! You are a Hufflepuff with a beautiful pet rat

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

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions