C Sharp, having an issue with the spin button and displaying the images. See Pics   using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; using System.Net.Http.Headers; using System.Web;   namespace Slot_Machine {        public partial class Form1 : Form     {         //Create a Random object          Random rand = new Random();         //Create an image[] = the URL to the images.          private Image[] images = new Image[]         { Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Apple.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Banana.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Grapes.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Cherries.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Lemon.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Lime.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Orange.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Pear.bmp"),           Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Strawbwerries.bmp")         }; public Form1()         {             InitializeComponent();         }         //Create a random method          void RandomPicutes()         {             pictureBox1.Image = images[rand.Next(0, images.Length)];             pictureBox2.Image = images[rand.Next(0, images.Length)];             pictureBox3.Image = images[rand.Next(0, images.Length)];         }         int FriutMactches()         {             int matches = 1;             if (pictureBox1.Image == pictureBox2.Image) ++matches;             if (pictureBox2.Image == pictureBox3.Image) ++matches;             return matches;         }         void spinButton_Click(object sender, EventArgs e)         {             Random rand = new Random();             int index = rand.Next(images.Count);         }     } }

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter1: An Overview Of Computers And Programming
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question

C Sharp, having an issue with the spin button and displaying the images. See Pics 

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Net.Http.Headers;
using System.Web;  

namespace Slot_Machine
{
       public partial class Form1 : Form
    {
        //Create a Random object 
        Random rand = new Random();
        //Create an image[] = the URL to the images. 
        private Image[] images = new Image[]
        { Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Apple.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Banana.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Grapes.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Cherries.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Lemon.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Lime.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Orange.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Pear.bmp"),
          Image.FromFile("C:\\Users\\shari\\OneDrive\\Desktop\\Friut\\Strawbwerries.bmp")
        };

public Form1()
        {
            InitializeComponent();
        }

        //Create a random method 
        void RandomPicutes()

        {
            pictureBox1.Image = images[rand.Next(0, images.Length)];
            pictureBox2.Image = images[rand.Next(0, images.Length)];
            pictureBox3.Image = images[rand.Next(0, images.Length)];
        }
        int FriutMactches()
        {
            int matches = 1;
            if (pictureBox1.Image == pictureBox2.Image) ++matches;
            if (pictureBox2.Image == pictureBox3.Image) ++matches;

            return matches;
        }

        void spinButton_Click(object sender, EventArgs e)
        {
            Random rand = new Random();
            int index = rand.Next(images.Count);
        }

    }
}

Fruit Slot Machine
Let's Play !
Amount Inserted $
SPIN
EXIT
Transcribed Image Text:Fruit Slot Machine Let's Play ! Amount Inserted $ SPIN EXIT
Form1.cs 4 Form1.Designer.cs
Fruit Slot Machine
Let's Play !
Amount Inserted $
Form1.cs [Design] → X
SPIN
0-0-0
0………………
O
EXIT
…………………..
0
0
0-0-0
4
X
Transcribed Image Text:Form1.cs 4 Form1.Designer.cs Fruit Slot Machine Let's Play ! Amount Inserted $ Form1.cs [Design] → X SPIN 0-0-0 0……………… O EXIT ………………….. 0 0 0-0-0 4 X
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Terminal Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage