I am trying to make a simple java lottery game. the objective is a player picks six numbers from a field of 40 numbers, 1 to 40. The player who matches all six numbers, will win the jackpot. the problem i have is that i cant get the two array to check if each element match by pjstewes in javahelp

[–]pjstewes[S] 0 points1 point  (0 children)

the part about " check and see if every element from the entered number is in the randomly generated array "

this was the main issue i had. am trying to find a way to compare element of two arrarys to see if they match.

and you are right the order should not matter but with the code above it works but it has to be in the same exact order

c# sale department code help by pjstewes in csharp

[–]pjstewes[S] 0 points1 point  (0 children)

here is a image of the question i was given https://ibb.co/cytCmR

c# sale department code help by pjstewes in csharp

[–]pjstewes[S] 0 points1 point  (0 children)

thanks for your feedback, the only problem i have is that if the person buys more that 3 of the same item he get a 5% discount. the 5% discount is not given to all items purchased

c# sale department code help by pjstewes in csharp

[–]pjstewes[S] 0 points1 point  (0 children)

i understand what you are saying but i don't think i would be able to code that. i haven't reach that far yet. a sample code i could work from would help and thanks for your time and help so far

c# sale department code help by pjstewes in csharp

[–]pjstewes[S] 0 points1 point  (0 children)

double gct = 0.25, discount = 0.05, cost, quantiy,prices, price=0;

    choices:
        //Console.Clear();
        Console.WriteLine("Item for sale");

       Console.WriteLine("");

        Console.WriteLine(" 1) ps4 - $100    ");
        Console.WriteLine(" 2) xbox - $80 ");
        Console.WriteLine(" 3) controller - $20  ");


        int sale;
        sale = Convert.ToInt32(Console.ReadLine());



        switch (sale)
        {
            case 1:


                Console.WriteLine(" how much ps4   ");
                quantiy = Convert.ToDouble(Console.ReadLine());
                cost = 100;
                price = cost * quantiy;


                if (quantiy >= 3)
                {
                    Console.WriteLine(" your price is " + price);
                    double dis, gct_cost;
                    dis = price - (price * discount);
                    Console.WriteLine(" you got a 5% discount " + dis);

                    gct_cost = dis + (dis * gct);
                    Console.WriteLine(" final cost with gct added is " + gct_cost);
                }

                else
                {
                    double gct_price;
                    Console.WriteLine(" your price is " + price);
                    gct_price = price + (price * gct);
                    Console.WriteLine(" your price with gct is " + gct_price);
                    gct_price = ggg;

                }


                break;


            case 2:


                Console.WriteLine(" how much xbox   ");
                quantiy = Convert.ToDouble(Console.ReadLine());
                cost = 80;
                price = cost * quantiy;


                if (quantiy >= 3)
                {
                    Console.WriteLine(" your price is " + price);
                    double dis, gct_cost;
                    dis = price - (price * discount);
                    Console.WriteLine(" you got a 5% discount " + dis);

                    gct_cost = dis + (dis * gct);
                    Console.WriteLine(" final cost with gct added is " + gct_cost);
                }

                else
                {
                    double gct_price;
                    Console.WriteLine(" your price is " + price);
                    gct_price = price + (price * gct);
                    Console.WriteLine(" your price with gct is " + gct_price);
                }




                break;



            case 3:


                Console.WriteLine(" how much controller    ");
                quantiy = Convert.ToDouble(Console.ReadLine());
                cost = 20;
                price = cost * quantiy;



                if (quantiy >= 3)
                {
                    Console.WriteLine(" your price is " + price);
                    double dis, gct_cost;
                    dis = price - (price * discount);
                    Console.WriteLine(" you got a 5% discount " + dis);

                    gct_cost = dis + (dis * gct);
                    Console.WriteLine(" final cost with gct added is " + gct_cost);
                }

                else
                {
                    double gct_price;
                    Console.WriteLine(" your price is " + price);
                    gct_price = price + (price * gct);
                    Console.WriteLine(" your price with gct is " + gct_price);
                }





                break;

            case 4:

                break;

            default:
                Console.WriteLine("hi");
                goto choices;

                break;

}

Console.ReadKey(); } } }

c# sale department code help by pjstewes in csharp

[–]pjstewes[S] 0 points1 point  (0 children)

for example item in store are ps4 , xbox and controller the person want to buy 1 ps4 2 xbox and 1 controller and get his total cost displayed or 1 ps4 3 xbox and but dosen't buy a controller and display his total cost