Ana sayfa
/
Teknoloji
/
For example: 2023510028 all yildirim.cs Write a C# program for "Jackpot Machine" that prints the coins the player gets. There are three reels which has numbers between 1 and 6 in the different 3 colors (red. blue and green). - If the reels show the same number in the same colors, he gets 30 points. le. (4 4 4) or (333) or (6 66) or __ - If the reels show the same number in the different colors, he gets 28 points. i.e. (1 1 1) or (5 5 5) or (333) or __ - If the reels show the same number, but they are not all the same color and not all the different colors, he gets 26 points. le. (1 1 1) or (5 5 5) or (333) or __ - If the reels show the consecutive numbers in the same color, he gets 20 points. i.e. (2 3 4) or (321) or (5 3 4) or __ - If the reels show the consecutive numbers in the different colors, he gets 18 points. le. (234) or (321) or (5 3 4) or __ - If the reels show the consecutive numbers, but they are not all the same color and'not all the different colors he gets 16 points. i.e. (2 3 4) or (321) or (5 3 4) or __ - If the reels show the different numbers (not consecutive numbers, not any equality) in the same color, he gets 10 points. le. (142) or (2 5 1) or (4 62) or __ - If the reels show the different numbers (not consecutive numbers, not any equality) in the different colors, he gets 8 points. le (1 5 6) or (352) or (4 16) or __ - If the reels show the same color, but they are not all equal, not all the consecutive numbers and not all the different numbers, he gets 6 points. le. (1 4 4) or (2 5 5) or (662) or __ - Otherwise, he gets 0 points. Le. (114) or (2 26) or __ BONUS: In addition to above conditions, if all numbers are even or odd in any color(s)he gets extra bonus 3. i.e. (246) or (355) or (646) or (5 1 3) or (222) or (222) or __ The numbers on the Jackpot machine should be generated randomly, therefore please don't take any input from the user in this part. Then the score the player gets should be calculated and printed. After that, the program should ask the user whether he/she wants to play again or not According to the choice of the user. the game should be repeated or over. At the end of the program (when the user selects not repeating the game), total score obtained during different game plays should also be printed. Sample Output: 555 Congratulations! You win 528. You win 93 bonus.

Soru

For example:	2023510028 all yildirim.cs
Write a C# program for "Jackpot Machine" that prints the coins the player gets.
There are three reels which has numbers between 1 and 6 in the different 3 colors (red. blue and green).
- If the reels show the same number in the same colors, he gets 30 points.
le. (4 4 4) or (333) or (6 66) or __
- If the reels show the same number in the different colors, he gets 28 points.
i.e. (1 1 1) or (5 5 5) or (333) or __
- If the reels show the same number, but they are not all the same color and not all the different colors, he gets 26 points.
le. (1 1 1) or (5 5 5) or (333) or __
- If the reels show the consecutive numbers in the same color, he gets 20 points.
i.e. (2 3 4) or (321) or (5 3 4) or __
- If the reels show the consecutive numbers in the different colors, he gets 18 points.
le. (234) or (321) or (5 3 4) or __
- If the reels show the consecutive numbers, but they are not all the same color and'not all the different colors he gets 16
points.
i.e. (2 3 4) or (321) or (5 3 4) or __
- If the reels show the different numbers (not consecutive numbers, not any equality) in the same color, he gets 10
points.
le.
(142) or (2 5 1) or (4 62) or __
- If the reels show the different numbers (not consecutive numbers, not any equality) in the different colors, he gets 8
points.
le (1 5 6) or (352) or (4 16) or __
- If the reels show the same color, but they are not all equal, not all the consecutive numbers and not all the different
numbers, he gets 6 points.
le. (1 4 4) or (2 5 5) or (662) or __
- Otherwise, he gets 0 points.
Le. (114) or (2 26) or __
BONUS: In addition to above conditions, if all numbers are even or odd in any color(s)he gets extra bonus 3.
i.e. (246) or (355) or (646) or (5 1 3) or (222) or (222) or __
The numbers on the Jackpot machine should be generated randomly, therefore please don't take any input from the user
in this part. Then the score the player gets should be calculated and printed.
After that, the program should ask the user whether he/she wants to play again or not According to the choice of the user.
the game should be repeated or over. At the end of the program (when the user selects not repeating the game), total score
obtained during different game plays should also be printed.
Sample Output:
555
Congratulations!
You win 528.
You win 93 bonus.

For example: 2023510028 all yildirim.cs Write a C# program for "Jackpot Machine" that prints the coins the player gets. There are three reels which has numbers between 1 and 6 in the different 3 colors (red. blue and green). - If the reels show the same number in the same colors, he gets 30 points. le. (4 4 4) or (333) or (6 66) or __ - If the reels show the same number in the different colors, he gets 28 points. i.e. (1 1 1) or (5 5 5) or (333) or __ - If the reels show the same number, but they are not all the same color and not all the different colors, he gets 26 points. le. (1 1 1) or (5 5 5) or (333) or __ - If the reels show the consecutive numbers in the same color, he gets 20 points. i.e. (2 3 4) or (321) or (5 3 4) or __ - If the reels show the consecutive numbers in the different colors, he gets 18 points. le. (234) or (321) or (5 3 4) or __ - If the reels show the consecutive numbers, but they are not all the same color and'not all the different colors he gets 16 points. i.e. (2 3 4) or (321) or (5 3 4) or __ - If the reels show the different numbers (not consecutive numbers, not any equality) in the same color, he gets 10 points. le. (142) or (2 5 1) or (4 62) or __ - If the reels show the different numbers (not consecutive numbers, not any equality) in the different colors, he gets 8 points. le (1 5 6) or (352) or (4 16) or __ - If the reels show the same color, but they are not all equal, not all the consecutive numbers and not all the different numbers, he gets 6 points. le. (1 4 4) or (2 5 5) or (662) or __ - Otherwise, he gets 0 points. Le. (114) or (2 26) or __ BONUS: In addition to above conditions, if all numbers are even or odd in any color(s)he gets extra bonus 3. i.e. (246) or (355) or (646) or (5 1 3) or (222) or (222) or __ The numbers on the Jackpot machine should be generated randomly, therefore please don't take any input from the user in this part. Then the score the player gets should be calculated and printed. After that, the program should ask the user whether he/she wants to play again or not According to the choice of the user. the game should be repeated or over. At the end of the program (when the user selects not repeating the game), total score obtained during different game plays should also be printed. Sample Output: 555 Congratulations! You win 528. You win 93 bonus.

Çözüm

4.5348 Voting
avatar
Poyraz
Profesyonel · 6 yıl öğretmeni
Uzman doğrulaması

Cevap

Here's a C# program that implements the "Jackpot Machine" game as described:<br />```csharp<br />using System;<br /><br />class Program<br />{<br /> static void Main()<br /> {<br /> int totalScore = 0;<br /> int currentScore = 0;<br /><br /> Random random = new Random();<br /> int[] reel1 = new int[6];<br /> int[] reel2 = new int[6];<br /> int[] reel3 = new int[6];<br /><br /> // Initialize the reels with random numbers<br /> for (int i = 0; i < 6; i++)<br /> {<br /> reel1[i] = random.Next(1, 7);<br /> reel2[i] = random.Next(1, 7);<br /> reel3[i] = random.Next(1, 7);<br /> }<br /><br /> // Calculate the score based on the reels' values<br /> if (reel1[0] == reel1[1] && reel1[0] == reel1[2] && reel1[0] == reel2[0] && reel1[0] == reel2[1] && reel1[0] == reel2[2] && reel1[0] == reel3[0] && reel1[0] == reel3[1] && reel1[0] == reel3[2])<br /> {<br /> currentScore += 30;<br /> }<br /> else if (reel1[0] == reel1[1] || reel1[0] == reel1[2] || reel1[0] == reel2[0] || reel1[0] == reel2[1] || reel1[0] == reel2[2] || reel1[0] == reel3[0] || reel1[0] == reel3[1] || reel1[0] == reel3[2])<br /> {<br /> currentScore += 26;<br /> }<br /> else if ((reel1[0] == reel1[1] || reel1[0] == reel1[2]) && (reel2[0] == reel2[1] || reel2[0] == reel2[2]) && (reel3[0] == reel3[1] || reel3[0] == reel3[2]))<br /> {<br /> currentScore += 20;<br /> }<br /> else if ((reel1[0] == reel1[1] || reel1[0] == reel1[2]) && (reel2[0] == reel2[1] || reel2[0] == reel2[2]) && (reel3[0] == reel3[1] || reel3[0] == reel3[2]))<br /> {<br /> currentScore += 18;<br /> }<br /> else if ((reel1[0] == reel1[1] || reel1[0] == reel1[2]) && (reel2[0] == reel2[1] || reel2[0] == reel2[2]) && (reel3[0] == reel3[1] || reel3[0] == reel3[2]))<br /> {<br /> currentScore += 16;<br /> }<br /> else if (reel1[0] == reel1[1] || reel1[0] == reel1[2] || reel2[0] == reel2[1] || reel2[0] == reel2[2] || reel3[0] == reel3[1] || reel3[0] == reel3[2])<br /> {<br /> currentScore += 10;<br /> }<br /> else if (reel1[0]!= reel1[1] && reel1[0]!= reel1[2] && reel2[0]!= reel2[1] && reel2[0]!= reel2[2] && reel3[0]!= reel3[1] && reel3[0]!= reel3[2])<br /> {<br /> currentScore += 0;<br /> }<br /> else<br /> {<br /> currentScore += 0;<br /> }<br /><br /> // Check if all numbers are even or odd in any color(s)<br /> if ((reel1[0] % 2 == 0 && reel2[0] % 2 == 0 && reel3[0] % 2 == 0) || (reel1[0] % 2!= 0 && reel2[0] % 2!= 0 && reel3[0] % 2!= 0))<br /> {<br /> currentScore += 3;<br /> }<br /><br /> // Print the current score<br /> Console.WriteLine($"You got {currentScore} points this time!");<br /><br /> // Add the current score to the total score<br /> totalScore += currentScore;<br /><br /> // Ask the user if they want to play again<br /> Console.Write("Do you want to play again?
Derecelendirmek için tıklayın: