957 AM 77 oo H20 LTE ehacc haccedu Your HACC Bucks lottery t

9:57 AM 77%, oo H20 LTE ehacc hacc.edu Your HACC Bucks lottery ticket consists of your 6 lucky numbers. The winning combination consists of 6 unique numbers (between 1 and 400. The prizes are as follows: Amount Category S10 exactly one match exactly two matches S25 per match 3, 4 or 5 matches S50 per match 3, 4 or 5 consecutive matches S1000 6 matches in any order S10.000 6 matches in exact order Each ticket claims the highest prize that it can. In addition, if there are fewer than 6 matches and if the sum of the numbers on the ticket equals the sum of the winning numbers, then the prize value is doubled. For example, suppose that your numbers are 1,9, 8,4, 2 and 3 (note that all numbers are unique), and the winning numbers are 8, 7, 2, 5,4, l (again, note that all numbers are unique). To figure out your prize value consider each of your numbers in turn: the 1 matches; the 9 does not match; the 8, 4, and 2 match (consecutively); and the 3 does not match. The four matches are worth $100 (each match is worth $25 by the third rule), while the three consecutive matches are worth S150 (each match is worth S50 by the fourth rule). Therefore, you claim a prize of$150. But wait! Because the sum of your numbers equals the sum of the winning numbers, your prize value is doubled to be worth $300! Input: Your ticket (6 numbers) followed by four winning combinations (each consists of6 numbers). Sample Input 5,2, 12, 22, 16, 38 8, 33, 19, 12, 40, 7 9, 7, 12, 22, 16, 40 1, 17, 19, 35, 25, 30 5,2, 13, 21, 15, 39 output: The value of your ticket won for each of the winning combinations. Sample output (to above data) 10 150

Solution

Here Iam posting the complete logics Hope you understand. and can implement them in jframes.

import java.util.Random;
import java.util.Scanner;

public class Lottery {

   public static void main(String[] args) {
       // TODO Auto-generated method stub

      
       // Scanner object to read the data from console
       Scanner obj=new Scanner(System.in);
      
       // Tp generate random number
       Random rm=new Random();
       // Array to store your numbers
       int yournumbers[]=new int[6];
       // Array to store win numbers
       int winnumbers[]=new int[6];
      
       System.out.println(\"Your input 6 numbers\");
       // Loading numbers
      
       for(int i=0;i<yournumbers.length;i++ )
       {
           yournumbers[i]=obj.nextInt();
       }
      
       for(int i=0;i<yournumbers.length;i++ )
       {
           System.out.print(yournumbers[i]+\" ,\");
       }
      
       // Generate lucky numbers
       // checking for unique numbers as well
       int index=0;
       int number;
       for(int i=0;i<yournumbers.length;i++ )
       {
          
                   number=rm.nextInt(40)+1;
                   winnumbers[i]=number;
           index++;
           for(int j=0;j<index-1;j++)
           {
               if(number==winnumbers[j])
               {
                   i=i-1;
               }
           }
       }
      
       for(int i=0;i<yournumbers.length;i++ )
       {
           System.out.print(winnumbers[i]+\" ,\");
       }
      
       // Calculating winning prizes
      
       int count=0;
      
       for(int i=0;i<yournumbers.length;i++ )
       {
           winnumbers[i]=yournumbers[i];
           count++;
       }
      
       if(count==6)
       {
           System.out.println(\"Your winning prize is \"+10000);
           int sum=0;
           for(int i=0;i<6;i++)
           {
               sum=sum+yournumbers[i];
           }
          
           if(10000==sum)
           {
               System.out.println(\"Your total winning prize is \"+20000);
           }
       }
       else if(count==3 || count==4 || count ==5)
       {
           System.out.println(\"Your winning prize is \"+(50*count));
          
           int sum=0;
           for(int i=0;i<6;i++)
           {
               sum=sum+yournumbers[i];
           }
          
           if(50*count==sum)
           {
               System.out.println(\"Your total winning prize is \"+(2*50*count));
           }
       }
       else
       {
           count=0;
           for(int i=0;i<6;i++)
           {
               for(int j=0;j<6;j++)
               {
                   yournumbers[i]=winnumbers[j];
                   count++;
               }
           }
          
           if(count==6)
           {
               System.out.println(\"Your winning prize is \"+1000);
               int sum=0;
               for(int i=0;i<6;i++)
               {
                   sum=sum+yournumbers[i];
               }
              
               if(1000==sum)
               {
                   System.out.println(\"Your total winning prize is \"+2000);
               }
           }
           else if(count==3 || count==4 || count ==5)
           {
               System.out.println(\"Your winning prize is \"+(25*count));
               int sum=0;
               for(int i=0;i<6;i++)
               {
                   sum=sum+yournumbers[i];
               }
              
               if((25*count)==sum)
               {
                   System.out.println(\"Your total winning prize is \"+(25*count*2));
               }
           }
           else if(count==2)
           {
               System.out.println(\"Your winning prize is \"+25);
               int sum=0;
               for(int i=0;i<6;i++)
               {
                   sum=sum+yournumbers[i];
               }
              
               if(25==sum)
               {
                   System.out.println(\"Your total winning prize is \"+(25*2));
               }
              
           }
           else if(count==1)
           {
               System.out.println(\"Your winning prize is:\"+10);
              
               int sum=0;
               for(int i=0;i<6;i++)
               {
                   sum=sum+yournumbers[i];
               }
              
               if((20)==sum)
               {
                   System.out.println(\"Your total winning prize is \"+(10*2));
               }
              
           }
           else
           {
               System.out.println(\"you did not win the prize\");
              
              
           }
          
       }
      
      
      
      
   }

}

 9:57 AM 77%, oo H20 LTE ehacc hacc.edu Your HACC Bucks lottery ticket consists of your 6 lucky numbers. The winning combination consists of 6 unique numbers (b
 9:57 AM 77%, oo H20 LTE ehacc hacc.edu Your HACC Bucks lottery ticket consists of your 6 lucky numbers. The winning combination consists of 6 unique numbers (b
 9:57 AM 77%, oo H20 LTE ehacc hacc.edu Your HACC Bucks lottery ticket consists of your 6 lucky numbers. The winning combination consists of 6 unique numbers (b
 9:57 AM 77%, oo H20 LTE ehacc hacc.edu Your HACC Bucks lottery ticket consists of your 6 lucky numbers. The winning combination consists of 6 unique numbers (b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site