Algorithms-and-Programming-Homework1

Assume that there is a “Jackpot Machine” with three reels. Each reel has letters between A and E (A, B, C, D, E) in the different 3 colors (red, blue, and green). The player pulls a handle to rotate the reels. The amount the player wins (or losses) depends on the letters and their colors that land along the pay line.

  • If each reel shows the same letter in the same color, he wins $22
  • If each reel shows the same letter in the different colors, he wins $20
  • If each reel shows the same letter, but not all the same or different color, he wins $18
  • If the reels show consecutive letters in the same color, he wins $16
  • If the reels show consecutive letters in the different colors, he wins $14
  • If the reels show consecutive letters, but not all the same or different color, he wins $12
  • If the reels show the same color, but not all the same letter and not consecutive, he wins $10
  • If the reels show the different colors, but not all the same letter and not consecutive, he wins $8
  • otherwise he loses (he gets $0) Write a program that randomly generates the values of the reels and then print the money the player gets. Don’t use array data structure.