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
Hitman42 [59]
2 years ago
14

Create a game that rolls two dies (number from 1 to 6 on the side) sequentially for 10 times (use loop). If at least once out of

10 times the sum of two random numbers is equal to 10, you win, else you loose. You will need to get your own method getRandom(int n) that generates a random number, see below (you can modify it as needed), a loop, and IF statement in the loop that checks if a sum of two random numbers is 10 or not.
Please start your program as follows, similar to what we did in class:
import java.util.Random;
public class UseRandom{
//your method getRandom() is here below, n is a range for a random number from 0 to n
public int getRandom(int n)
{
Random r=new Random();
int rand=r.nextInt(n);
return rand;
}
//code continues here, don't forget your main() method inside the class, and making your own object in main() using "new" keyword.
Computers and Technology
1 answer:
Alex73 [517]2 years ago
8 0

Answer:

Explanation:

The following code is written in Java and loops through 10 times. Each time generating 2 random dice rolls. If the sum is 10 it breaks the loop and outputs a "You Win" statement. Otherwise, it outputs "You Lose"

import java.util.Random;

class Brainly {

   public static void main(String[] args) {

       UseRandom useRandom = new UseRandom();

       boolean youWin = false;

       for (int x = 0; x<10; x++) {

           int num1 = useRandom.getRandom(6);

           int num2 = useRandom.getRandom(6);

           if ((num1 + num2) == 10) {

               System.out.println("Number 1: " + num1);

               System.out.println("Number 2: " + num2);

               System.out.println("You Win");

               youWin = true;

               break;

           }

       }

       if (youWin == false) {

           System.out.println("You Lose");

       }

   }

}

class UseRandom{

   public int getRandom(int n)

   {

       Random r=new Random();

       int rand=r.nextInt(n);

       return rand;

   }}

You might be interested in
Write a recursive function that returns 1 if an array of size n is in sorted order and 0 otherwise. Note: If array a stores 3, 6
galina1969 [7]

Answer:

The function in C++ is as follows:

int isSorted(int ar[], int n){

if (n == 1 || n == 0){

 return 1;}

if (ar[n - 1] < ar[n - 2]){

 return 0;}

return isSorted(ar, n - 1);}

Explanation:

This defines the function

int isSorted(int ar[], int n){

This represents the base case; n = 1 or 0 will return 1 (i.e. the array is sorted)

if (n == 1 || n == 0){

 return 1;}

This checks if the current element is less than the previous array element; If yes, the array is not sorted

if (ar[n - 1] < ar[n - 2]){

 return 0;}

This calls the function, recursively

return isSorted(ar, n - 1);

}

6 0
2 years ago
Jenny wants to create an animated short video to add to her website. Which software will she use to create this animated video?
denis23 [38]
Adobe Spark or Adobe Premier.
6 0
3 years ago
For this assignment: Analyze and describe the network infrastructure. Describe and explain the various policies that will be nee
mamaluj [8]

Answer:

Explanation:

The Network infrastructure shown here are LAN and WAN. Wired and wireless communications.

The Various policies are:

1. Group related items together, for instance, grouping all Windows servers, into one virtual LAN (VLAN). Other asset groups might include infrastructure (routers, switches, VPNs and VoIP) in one VLAN and security assets (IDS, firewalls, web filters and scanners) may be grouped in another.

2. In general, it is good to adopt a default deny access posture for each VLAN.

3. Network segmentation is a very significant, long-term project, but each step along the way increases security. Log all traffic between segments to determine what is normal and needed for effective functioning.

4. Network segmentation is undeniably and unquestionably an effective component in a defense in depth strategy. Organizations that implement it must be prepared to manage scores of firewalls, switches and routers, each with hundreds of rules, all of which may be affected by the network segmentation process and potentially by updates and changes, even after it is in place.

5. Contribute to a secure WAN environment for all connected departments, offices,

agencies, boards, and commissions

6. Provide a uniform security framework to secure the integrity, confidentiality, and availability of info and info systems, at the WAN level.

7. Provide, in balance with operational requirements, legislative requirements, and information sharing agreements, the minimum WAN security requirements.

8. Raise awareness of information and information technology security needs for all users of the WAN by providing the security principles, requirements.

9. Define the clear roles and responsibilities of all users of the WAN, particularly WAN security staff.

* Vulnerabilities and exposures

1. Data requiring special protection such as credit card numbers that need to comply with PCI-DSS or patient information that is subject to HIPAA should be isolated from other data and put in their own VLANs.

2. Your aim is to limit access to sensitive information to those who need it within the organization and to create roadblocks to stop or slow intruders, who may have broken through one layer of security, from doing further damage.

3. Network segmentation is not a “set and forget” undertaking. The network access policy, defined in firewalls, routers and related devices, changes constantly to cater to new business requirements. Ensure that new changes do not violate your segmentation strategy requires a good degree of visibility and automation.

4. Reducing internal breaches and the infiltration of malicious software(malware). This

internal defense requires significant involvement with individual devices

on a network, which creates greater overhead on network administrators.

*Risks

1. Malicious software, also known as malware,makes its way onto a network through

employees, contractors and visitors. Personal laptops, wireless gadgets,

and of course the USB flash drives, all these provide excellent vectors through which

malware can enter the workplace.

2. Hackers, worms, spammers and other security dangers of the Internet via LAN.

3. The various vulnerabilities on your network represent potential costs — time, money and assets — to your library. These costs, along with the chance someone will exploit these vulnerabilities, help determine the level of risk involved.

4. Since the cost of adding another Internet connection, increasing the speed of the current connection or purchasing complex network monitoring equipment might be too prohibitive, the library has a higher tolerance for a periodically slow Internet connection.

5. External flash drives and other media are also concern when those enters the network.

6. The lost or stolen handheld device poses some serious risks if not incorporated into your network security policy. Such devices are often capable of being formatted of all company content remotely in the case of theft or robbery.

*Security measurements:

1. Address Resolution

Protocol (ARP) spoofing, Denial of Service (DoS) attacks such as Tear Drop

or Ping of Death.

2. In addition, network administrators can form a policy whereby network

users are required to install and maintain anti-malware scanners in their devices.

3. Many tools exist to check the existing security state of your network. The Microsoft Baseline Security Analyzer, Nmap .

4. Risk assessment is a combination of both quantifying (the cost of the threat) and qualifying (the odds of the attack).

5. Firewalls.

6. Antivirus systems.

7. Intrusion-detection systems (Host-based IDS,Network-based IDS)

8. Port scanners.

9. Network sniffers.

10. A vulnerability scanner is like a port scanner on steroids.

*Unnecessary Ports

1. It is not easy to say which ports exactly but we should know that the service ports which are open among 65,535 ports and although not exactly sure what service is running , it is safer to check the port and close it as "A Closed Port is a Safe Port".

7 0
3 years ago
What should you do when an error message pops up on the screen?
Shtirlitz [24]
The best thing to do when an error message appears when it is not supposed to, as in if you are blocked by an administrator and it appears then its supposed to, it is best to contact someone who can investigate whether or not something is happening to your computer. That could be a parent, if they are good with computers, or just tech support at a store, provided they also know computers. Most of the time your computer just makes a mistake so nothing to worry about, but make sure to have it checked just to be sure. 
7 0
3 years ago
What is cloud storage?
Lana71 [14]

in cloud storage we can save data online

8 0
3 years ago
Read 2 more answers
Other questions:
  • Again, consider what you believe to be the goal of performing a penetration test. Why would you worry about doing any privilege
    14·1 answer
  • To apply format to text, both the text and the text box must be selected.
    13·1 answer
  • A company that hires only American Indians is practicing
    5·2 answers
  • According to the article in WikiAnswers, digital communication systems have more benefits than analog systems. They are faster a
    10·2 answers
  • A collision volume is called ____
    7·1 answer
  • Interpretations of the AICPA Code of Professional Conduct are dominated by the concept of: Question 4 options: 1) independence.
    5·1 answer
  • In excel, a number can contain the characters__
    8·1 answer
  • What does the following Boolean operators do?<br>AND function<br>OR function<br>NOT function​
    8·1 answer
  • How does the autosum command calculate data? Need help ASAP​
    5·1 answer
  • Describe some things that this person might say that might cause you to NOT hire them. Explain.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!