1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lelu [443]
2 years ago
9

Describe the necessary Java commands to create a Java program for creating a lottery program using arrays and methods.

Computers and Technology
2 answers:
netineya [11]2 years ago
5 0
I think each lottery ticket will cost £5 each so you would count in 5s till you reach the amount of tickets to get the answer which is £25
wariber [46]2 years ago
5 0

Answer: would use the for loop in this java program. A for loop is a repetition control structure that allows you to write a loop that needs to be executed a specific number of times which is why it's beneficial for the lottery program. A for loop is useful when you know how many times a task is to be repeated. import java.util.Random;import java.util.Scanner;public class LotteryGame

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

Random r = new Random();     
int random[] = new int[5];   

  for (int i = 0; i < 5; ++i) {   
     random[i] = r.nextInt(48) + 1;     } 

    Scanner


sc = new Scanner(System.in);    
 int usernumbers[] = new int[5];     

System.out.print("Enter 5 numbers: ");  

   for (int i = 0; i < 5; ++i) { 

  usernumbers[i] = sc.nextInt();     }     

System.out.print("\nRandom Numbers: ");    
 for (int i = 0; i < 5; ++i)        

System.out.print(random[i] + " ");  
   System.out.print("\nUser Entered Numbers: ");     for (int i = 0; i < 5; ++i)        

System.out.print(usernumbers[i] + " ");   

  int match = 0;    
 for (int i = 0; i < 5; ++i) {       
 for (int j = 0; j < 5; ++j) {          

 if (random[i] == usernumbers[j])              
++match;        }

     }     
System.out.println("\nThere are " + match + " number of matches");  }

Explanation:

You might be interested in
What are Three types of informational references
Irina-Kira [14]

Answer:

There are many types of information al references such as Encyclopedias, dictionaries, thesaurus Almanacs, atlases, thesauruses, Atlases, almanacs, and encyclopedias.

Explanation:

There are also informational websites. The way to find this is to look at the website url to see if it ends in .gov, .edu, and .org . But make sure you cite your source so you don't plagiarize.

If you don't have any questions feel free to ask in the comments.

3 0
3 years ago
Read 2 more answers
What is displayed on the console when running the following program?
Andre45 [30]

Answer:

The answer is "Option A"

Explanation:

In the given java code, a class "Test" is defined, inside the main method try and catch block is used, inside the try block method "p()" is called, that print a message. in this block two catch block is used, that works on "NumberFormatException" and "RuntimeException".  In the method "p" declaration, a string variable "s" is defined, that holds double value, that is "5.6", and converts its value into the wrong integer, and other wrong option can be described as follows:

  • In option B, it is wrong, it is not followed by after call method.
  • In option C, It is not followed by runtime exception, that's why it is incorrect.
  • Option D and Option E both were wrong because they can't give run time and compile-time error.  
6 0
3 years ago
. wireless network adapters differ from regular networkadapters because theycontain………………..
Nataly_w [17]

Answer: Transceivers

Explanation:

 Wireless network adapters differ from regular network adapters because they contain transceivers as, the transceiver is that portion of the network interface which transmitted the data by concerting digital data into the digital signals in the medium. Basically, the network adapter are responsible for connected the host in the network medium and also convert the binary form data.Transceiver signal are basically depends upon the type of the network.

8 0
3 years ago
3. For “Incident Energy Analysis” What body parts are involved in the distance
krek1111 [17]

The body part that is close to the arc flash boundary is the energized conductors or circuit parts.

<h3>What is the distance of an arc flash?</h3>

The working distance is known to be the distance that exist between a person and the center of an arc flash.

Note that The body part that is close to the arc flash boundary is the energized conductors or circuit parts.

Learn more about Energy from

brainly.com/question/13881533

#SPJ1

7 0
1 year ago
Write commands to carry out the following commands: a) Print all lines containing the string John. b) Print all lines where a wo
egoroff_w [7]

Answer:

see explaination

Explanation:

1.

1. grep 'John' FileName

2. grep '^\J' FileName

3. grep 'stopped$' FileName

4. grep -v -e 'was' FileName

5. grep -E '^(k|K)' FileName

2.

#print the message to create subdirectory

echo "Creating a subdirectory to copy current directory files into named 'sub'"

#create subdirectory

mkdir sub

echo "Directory successfully created"

#Copy the files in the current working directory to created subdirectory

echo "Copying files of current directory into newly created subdirectory"

rsync -a --exclude='sub' * sub

#display the message to copy the files

echo "Copying operation completed successfully"

echo "Now deleting the created subdirectory along with its contents"

rm -rf sub

#indicated the message completion of task

echo "Operation completed successfully."

3.

#prompt and read the first number

echo "Enter the first number: "

read x

echo "Enter the second number: "

read y

#Compute arithmetic operations and store in the

#respective variable

addition=$(($x + $y))

subtraction=$(($x - $y))

multiplication=$(($x * $y))

division=$(($x / $y))

#print the values

echo "Addition of $x and $y is $addition"

echo "Subtraction of $x and $y is $subtraction"

echo "Multiplication of $x and $y is $multiplication"

echo "Division of $x and $y is $division"

3 0
3 years ago
Other questions:
  • The Internet of Things (IoT) is a concept with emphasis on machine-to-machine communications to describe a more complex system t
    10·1 answer
  • Oxygen-18 has an atomic number of 8. How many neutrons are in this isotope?
    7·1 answer
  • The practice of using similar but not identical domain names is called _____. domain spoofing domain masquerading domain tasting
    13·1 answer
  • Andre is teaching a class without the software development cycle while teaching the analyst phase which task should Andre mentio
    8·1 answer
  • 1
    5·2 answers
  • What does a proxy server do?<br> Help please!!
    12·1 answer
  • Which best describes IMEI?
    5·1 answer
  • Given two variables matric_age and grad_age, write a statement that makes the associated value of grad_age 4 more than that of m
    15·1 answer
  • What year did the first hovercraft sail on water
    15·1 answer
  • Monero is cryptocurrency that focuses on transparency of ownership. True or false
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!