Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 2 - Exercises - Page 86: 7

Answer

1. Make two variables, one for each of the numbers in the pair. Also make 3 variables; one for wins, one for losses, and one for ties. 2. Take in both of the scores in the pair and compare them 3. If the first value is greater than the second, increase wins by 1. If the first value is equal to the second, increase ties by 1. If the first value is less than the second, increase losses by 1. 4. Repeat steps 2 and 3 until 10 pairs of numbers are inputted. 5. Print "Wins-Losses-Ties" where each variable's value is displayed. 6. If "wins==10" then print the message "Congratulations on your undefeated season

Work Step by Step

1. Make two variables, one for each of the numbers in the pair. Also make 3 variables; one for wins, one for losses, and one for ties. 2. Take in both of the scores in the pair and compare them 3. If the first value is greater than the second, increase wins by 1. If the first value is equal to the second, increase ties by 1. If the first value is less than the second, increase losses by 1. 4. Repeat steps 2 and 3 until 10 pairs of numbers are inputted. 5. Print "Wins-Losses-Ties" where each variable's value is displayed. 6. If "wins==10" then print the message "Congratulations on your undefeated season
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.