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
skad [1K]
3 years ago
8

The bag class in Chapter 5 has a new grab member function that returns a randomly selected item from a bag (using a pseudorandom

number generator). Suppose that you create a bag, insert the numbers 1, 2, and 3, and then use the grab function to select an item. Which of these situations is most likely to occur if you run your program 300 times (from the beginning): A. Each of the three numbers will be selected about 100 times. B. One of the numbers will be selected about 200 times; another number will be selected about 66 times; the remaining number will be selected the rest of the time. C. One of the numbers will be selected 300 times; the other two won't be selected at all.
Computers and Technology
1 answer:
Sphinxa [80]3 years ago
6 0
You have to use the 300 added inversatile
You might be interested in
______________________________Encompasses all of the information contained within a single business process or unit of work, and
Rudik [331]

Answer:

transactional information

Explanation:

8 0
3 years ago
Write a program to find and print the sum of the first n cubes in the following four ways.
klio [65]

Answer:

The solution code is written in Java.

  1. public class Main {
  2.    public static void main(String[] args) {
  3.           System.out.print("Please enter a number: ");
  4.           Scanner console = new Scanner(System.in);
  5.           int n = console.nextInt();
  6.           calculateSum1(n);
  7.           calculateSum2(n);
  8.           calculateSum3(n);
  9.           calculateSum4(n);
  10.    }
  11.    public static void calculateSum1 (int num){
  12.        int sum1 = 0;
  13.        for(int i=1; i <= num; i++){
  14.            sum1 += i*i*i;
  15.        }
  16.        System.out.println("Sum 1 : " + sum1);
  17.    }
  18.    public static void calculateSum2 (int num){
  19.        int sum2 = num * num * (num + 1) * (num + 1) / 4;
  20.        System.out.println("Sum 2 : " + sum2);
  21.    }
  22.    public static void calculateSum3 (int num){
  23.        int sum3 = 0;
  24.        for(int i=1; i <=num; i++){
  25.            sum3 += i;
  26.        }
  27.        sum3 = sum3 * sum3;
  28.        System.out.println("Sum 3 : " + sum3);
  29.    }
  30.    public static void calculateSum4 (int num){
  31.        int sum4 = (num * (num + 1) * (2*num + 1)) / (4+2);
  32.        System.out.println("Sum 4 : " + sum4);
  33.    }
  34. }

Explanation:

Firstly we create four different methods that calculate the sum of the first n cubes in different ways (Line 13 - 43).

This is important to understand the concept of  operator precedence to work out the different ways of summation.

For example, The operator * and / will always have higher precedence than +.

On another hand, any expression enclosed within the parenthesis will have highest precedence and therefore the value will be evaluated prior to others.  

This is also important to understand the expression evaluation will always start from left to right.

3 0
4 years ago
It is important to remember that in a supply? chain, the only source of revenue is the? _______.manufacturer/customer/raw materi
4vir4ik [10]
Probably the retailer
5 0
4 years ago
How do you change your age on here? I accidentally put that i was 15 but i am only 13. How do I change this?
oksano4ka [1.4K]
I honestly don't think they can or just change your account from what I know of I just tried just now to see for you. I think you jus gotta leave it lol. I'm 13 too I lit myself 16
5 0
3 years ago
In a class named InputTextToOutputFile.java use the following prompt to get the fileName of the output file from the user: "What
grin007 [14]

Answer:

Detailed program code is written at explaination

Explanation:

Program:

import java.io.File;

import java.io.FileWriter;

import java.io.IOException;

import java.util.Scanner;

public class InputTextToOutputFile

{

public static void main(String[] args) throws IOException

{

Scanner in=new Scanner(System.in);//Scanner object to get user input

System.out.println("What is the name of your output file? ");

String fileName = in.nextLine();//get output file name

File file = new File(fileName);//File object with fileName as input

//Create the file by method file.createNewFile()

if (file.createNewFile())

{

System.out.println("File is created!");

} else {

System.out.println("File already exists.");

}

//FileWriter object with user file name given as input

FileWriter writer = new FileWriter(file);

System.out.println("Enter text to write to a file : ");

String line;//variable to store line content

do {

line=in.nextLine();//get line content from user

writer.write(line+"\n"); //write content to file by adding new line(\n) character

}while(!line.equals("STOP!"));//repeat a loop until user enters "STOP!" line

writer.close();//close the file object

}

5 0
4 years ago
Other questions:
  • In cell F29, use an IF function to display the correct Shipping Charge, based on the amount of the Discounted Total. If the Disc
    9·1 answer
  • Computers have become easier to use and more powerful over time.
    12·2 answers
  • Explain why living things store energy in lipids instead of in carbohydrates
    5·1 answer
  • PLEASE HELP TAKING A TEST!!!
    10·2 answers
  • Give 5 uses of software and hardware.
    15·1 answer
  • The following code processes a file containing five positive numbers. What will the variable $result contain after the code is e
    13·1 answer
  • At the beginning of Section 5.2, it is stated that multiprogramming and multiprocessing present the same problems, with respect
    8·1 answer
  • Decision support systems (or DSSs) model information using OLAP, which provides assistance in evaluating and choosing among diff
    7·1 answer
  • The mainframe computer are the ____ and most ____ computers..​
    11·1 answer
  • HELLO. Which of the following is NOT a way to control the flow of a program?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!