Question: A magic square can be viewed as a 3 by 3 matrix where all rows columns and diagonals add up to the same sum of
A magic square can be viewed as a 3 by 3 matrix where all rows columns and diagonals add up to the same sum of 15. Your task is to create a full project called MagicSquare with a class with the same name. It will output the instructions that tells the user This is a game of a 3 by 3 magic square. You are to enter in 9 values row by row to see if you have gotten a magic square. It will display the 3 by 3 matrix you created and will tell you congratulations if you have entered a magic square or Sorry if you did not enter a magic square. Additionally it will display one correct magic square by Saying Computers version of magic square is and displays a version of a magic square.
You will create an election demo. You will create a 4 by 2 array. It will ask the user to enter in values for each of the candidates and it will display who won the election and total votes for each.
Sample output will be
Enter votes for Candidate1 in District 1:12
Enter votes for Candidate2 in District 1:21
Enter votes for Candidate1 in District 2:32
Enter votes for Candidate2 in District 2:14
Enter votes for Candidate1 in District 3:23
Enter votes for Candidate2 in District 3:21
Enter votes for Candidate1 in District 4:34
Enter votes for Candidate2 in District 4:54
Candidate 1 total votes was: 101
Candidate 2 total votes was: 110
The winner is Candidate 2!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
