Questions
You have just been put in charge of safety at your plant. The probability of an...

You have just been put in charge of safety at your plant. The probability of an injury occuring on any given day is p. Your boss says that once the company has 10 totoal days in which at least one injury is reported the insurance premium triples. To plan financially, she wants to know how many days to expect until the insurance premium is going to triple. Write a class called SafetyAnalysis.java that does the following:

a. Reads in a value of p from the user. Checks if it is a double and a feasible probability.

b. Determines if there is an injury each day. To do this, generate a random number between 0 and 1. If the number you generated is less than p then there was an injury. Otherwise, there was not an injury on that day.

c. Continue determining if there was an injury each day until a total of 10 days worth of injuries have occurred (hint: use a loop where you don’t know how many iterations are required).

d. Repeat b. - c. 1000 times (hint: use a loop where you do know how many iterations are required). Return the average number of days it takes until 10 total injuries occur. (hint: each time you complete c., you have a new value to include in your average) e. Report the average number of days over the 1000 experiments that it takes until 10 days of injuries occur. Print this value to the screen with the appropriate labeling information

In: Computer Science

A local biologist needs a program to predict population growth. The inputs would be: The initial...

A local biologist needs a program to predict population growth. The inputs would be: The initial number of organisms The rate of growth (a real number greater than 1) The number of hours it takes to achieve this rate A number of hours during which the population grows For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of 6 hours. Assuming that none of the organisms die, this would imply that this population would double in size every 6 hours. Thus, after allowing 6 hours for growth, we would have 1000 organisms, and after 12 hours, we would have 2000 organisms. Write a program that takes these inputs and displays a prediction of the total population. An example of the program input and output is shown below: Enter the initial number of organisms: 10 Enter the rate of growth [a real number > 0]: 2 Enter the number of hours to achieve the rate of growth: 2 Enter the total hours of growth: 6 The total population is 80

i am using python

In: Computer Science

A- Briefly explain what is the purpose of the SW operation in S-DES i.e. How would...

A- Briefly explain what is the purpose of the SW operation in S-DES i.e. How would S-DES be weakened if the SW operation was ommitted.

B- Briefly explain why in DES the key is 56-bits instead of 64-bits?

In: Computer Science

(PYTHON) A Prime number is an integer greater than 1 that cannot be formed by multiplying...

(PYTHON)

A Prime number is an integer greater than 1 that cannot be formed by multiplying two smaller integer other than 1 and itself. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1.

In this question you will write a program that takes a sequence of integers from the user and display all the prime numbers contained in that sequence.

We will separate this question in 2 steps:

Step 1 (5 pts) Write a script that accepts a sequence of positive integer from the user and display all the prime numbers from that sequence. Your program should accept and save in a list the input from the user until the value -1 is entered. Your program should also make sure that only positive values are entered. You can assume the users only enter integers.

Step 2 (5 pts) We can improve the program usability by adding the following functions:

- A function is_prime that receives an integer as parameter, check if this integer is a prime number and returns a boolean value depending on the result. -

A function find_primes that receives the user sequence as parameter and use the function is_prime to figure out which are the prime values. The function then returns a list containing all the prime values contained in the user sequence.

Your user input script should be similar as in part 1 and use the result of the find_primes function to display the list of prime numbers.

In: Computer Science

You have been appointed as a design engineer and assigned to design a secured network for...

You have been appointed as a design engineer and assigned to design a secured network
for a private organization. Evaluate your approach to improve the security posture of
your network before, during, and after your network implementation.

In: Computer Science

several trends and issues that are specifically relevant to the field of instructional design and technology.

several trends and issues that are specifically relevant to the field of instructional design and technology.

In: Computer Science

Goal: After the manager of a local McDonalds hired several ASU grads to work the cash...

Goal:

After the manager of a local McDonalds hired several ASU grads to work the cash registers, he realized that they were having trouble figuring out the correct amount of change to return to their customers. The manager wants you to create a VB.NET program that calculates the correct amount of change to be given to a customer following a transaction.

Guidelines:

You should have

  • Option Explicit On (this forces you to declare all of your variables)
  • Option Strict On (this forces you to explicitly convert from one data type to another rather than relying on VB.Net to make these conversions for you implicitly)
  • At least one relevant image on your form (lots of McDonalds and $$ images available on the Net)
  • Calculate, Clear, and Exit buttons along the bottom of your form

Inputs:

  Transaction Amount

  validation: data must have been entered, data must be numeric, amount cannot be negative or greater than $1000.00

Amount of Cash Provided By The Customer

validation: data must have been entered, data must be numeric,

amount cannot be negative and must be equal to or greater than the Transaction Amount

Outputs:

Total Amount of Change To Be Returned

Number of Twenties To Be Returned

Number of Tens To Be Returned

Number of Fives To Be Returned

Number of Ones To Be Returned

Number of Quarters To Be Returned

Number of Dimes To Be Returned

Number of Nickels To Be Returned

Number of Pennies To Be Returned

In: Computer Science

Guidelines Look up one of the many sites describing the BMI, and read a bit about...

Guidelines

Look up one of the many sites describing the BMI, and read a bit about how it is used to indicate general health. Create a VB.Net program that, given a user’s height in inches and weight in pounds, will calculate and display his/her BMI. After calculating the user's BMI, indicate the user's health status.  

BMI = (weight * 703) / (height * height)

Display the user’s Height Status:

    BMI

Health Status

Below 18.5

    Underweight

18.5 -24.9

    Normal

25 - 29.9

    Overweight

30 & Above

    Obese

Input: Height and Weight.

Output: BMI (to one decimal, like 27.7) and Weight Status (a string, like “Overweight”)

After the remarks at the top of your program, add “Option Explicit On” and “Option Strict On”. The former requires you to explicitly declare each variable used and the latter requires you to explicitly convert data from one type to another, rather than rely on VB.Net to implicitly convert data.    

In: Computer Science

describe how prime numbers or quadratic congruence can be used to crack an encryption system?

describe how prime numbers or quadratic congruence can be used to crack an encryption system?

In: Computer Science

Does anyone know how to find if a certain String is available in an ArrayList? I...

Does anyone know how to find if a certain String is available in an ArrayList?

I was asked by my instructor to make a certain program about Student Record

In the area where I need to add some student in the ArrayList it won't add if there is the same name in the ArrayList

at first I used the equals method and contains method but later I found it was prohibited to use such method.

Is there a way to find if a String is Available in the ArrayList without using the method

Please check on else if(response==2)

import java.util.*;
public class performanceTask {

   public static void main(String[] args) {
       int response;
       ArrayList<String> listOfStudent = new ArrayList<String>();

       Scanner aScanner = new Scanner(System.in);
       do {
           System.out.println("[Selection Bar]");
           System.out.println("[1] List of Students.");
           System.out.println("[2] Add Student.");
           System.out.println("[3] Edit Student.");
           System.out.println("[4] Delete Student.");
           System.out.println("[5] Clear list of Students.");
           System.out.println("[6] Exit Program.");
           System.out.println("--------------------------");
           System.out.println("Select an option: ");
           response = aScanner.nextInt();
          
           if(response == 1) {
               int size = listOfStudent.size();
               if(size == 0) {
                   System.out.println("No Records Found!\n");
               } else {
                   Collections.sort(listOfStudent);
                   for(int i = 0; i<listOfStudent.size(); i++) {
                       System.out.println(i + ". " + "[" + listOfStudent.get(i) + "]");
                      
                   }
                   System.out.println("\n");
              
               }
           }else if (response == 2) {
               System.out.println("Enter Name of a Student: ");
               String addStudent = aScanner.next();
              
               if (listOfStudent.contains(addStudent)) {
                   System.out.println(addStudent +" already existed! \n");
                  
               } else {
                   System.out.println("Do you want to save " + addStudent + "? [y/n]: ");
                   String saveIt = aScanner.next();
                       if(saveIt.equals("y") || saveIt.equals("Y") ) {
                           listOfStudent.add(addStudent);
                           System.out.println(addStudent +" has been successfully added! \n ");
                       }else if (saveIt.equals("n") || saveIt.equals("n")) {
                           System.out.println("\n");
                           continue;
                       }else {
                           System.out.println("It must be y or n only!");
                       }
                   }
              

In: Computer Science

1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary...

1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary format)

Hint: –17 + 0.375

Given the hint above, the fractional number will be divided into two parts,
- Whole number,
- Fractional part, must be positive

(2) Proof to check that your calculation above is correct

In: Computer Science

Spatial indexing with quadtrees in python The quadtrees data structure is a special type of tree...

Spatial indexing with quadtrees in python

The quadtrees data structure is a special type of tree structure, which can recursively divide a flat 2-D space into four quadrants. Each hierarchical node in this tree structure has either zero or four children. It can be used for various purposes like sparse data storage, image processing, and spatial indexing. Spatial indexing is all about the efficient execution of select geometric queries, forming an essential part of geo-spatial application design. For example, ridesharing applications like Ola and Uber process geo-queries to track the location of cabs and provide updates to users. Facebook’s Nearby Friends feature also has similar functionality. Here, the associated meta-data is stored in the form of tables, and a spatial index is created separately with the object coordinates. The problem objective is to find the nearest point to a given one. You can pursue quadtree data structure projects in a wide range of fields, from mapping, urban planning, and transportation planning to disaster management and mitigation. We have provided a brief outline to fuel your problem-solving and analytical skills. Objective: Creating a data structure that enables the following operations

 Insert a location or geometric space

 Search for the coordinates of a specific location

 Count the number of locations in the data structure in a particular contiguous area

In: Computer Science

SYSTEM RECOVERY It is highly probable that eventually something bad will happen to your data or...

SYSTEM RECOVERY

It is highly probable that eventually something bad will happen to your data or your hardware. What can you do to lessen the impact of these problems? You can look at both hardware and software solutions. What is fault tolerance?

In: Computer Science

a) Why is it essential to distinguish between and specify both user requirements and system requirements...

a) Why is it essential to distinguish between and specify both user requirements and system requirements in the software specification process? Using one of the systems presented in Section 1.3, present one user requirement and the system requirements derived from it. b) How do you validate the user requirements and system requirements? Explain your validation procedure (~ step by step)for the above requirements.c) How do you do the software validation for the same requirements you selected above?Hint: ReviewSections 1.3 Case Studies,2.2.1Software Specification, and 2.2.3 Software Validation.

In: Computer Science

In C++                                          &n

In C++

                                                        Circle

-int x //x coord of the center

-int y // y coord of the center

-int radius

-static int count // static variable to keep count of number of circles created

+ Circle()                     //default constructor that sets origin to (0,0) and radius to 1

+Circle(int x, int y, int radius)   // regular constructor

+getX(): int

+getY(): int

+getRadius(): int

+setX(int newX: void

+setY(int newY): void

+setRadius(int newRadius):void

+getArea(): double // returns the area using formula pi*r^2

+getCircumference // returns the circumference using the formula 2*pi*r

+toString(): String   // return the circle as a string in the form (x,y) : radius

+getDistance(Circle other): double // * returns the distance between the center of this circle and the other circle

+moveTo(int newX,int newY):void // * move the center of the circle to the new coordinates

+intersects(Circle other): bool //* returns true if the center of the other circle lies inside this circle else returns false

+resize(double scale):void// * multiply the radius by the scale

+resize(int scale):Circle // * returns a new Circle with the same center as this circle but radius multiplied by scale

+getCount():int //returns the number of circles created

//note that the resize function is an overloaded function. The definitions have different signatures

  1. Extend the driver class to do the following:
    1. Declare a vector of circles
    2. Call a function with signature inputData(vector<Circle> &, string filename) that reads data from a file called dataLab4.txt into the vector. The following c-e are done in this function
    3. Use istringstream to create an input string stream called instream. Initialize it with each string that is read from the data file using the getline method.
    4. Read the coordinates for the center and the radius from instream to create the circles
    5. Include a try catch statement to take care of the exception that would occur if there was a file open error. Display the message “File Open Error” and exit if the exception occurs
    6. Display all the circles in this vector using the toString method
    7. Use an iterator to iterate through the vector to display these circles
    8. Display the count of all the circles in the vector using the getCount method
    9. Display the count of all the circles in the vector using the vector size method
    10. Clear the vector
    11. Display the current count of all the circles using the getCount method
    12. Display the current count of all the circles using the vector size method
    13. Use the cout statements and other helper statements given to you in the template in Zylabs

Create "Circle.h"

Create "Circle.cpp"

Complete Main.cpp

#include<iostream>
#include "Circle.h"
#include <fstream>
#include <vector>
#include<cstdlib>

#include <fstream>
#include <sstream>
void inputData(vector<Circle> &circleVector, string filename){
//create the input string stream called instream

//open file
//if there is a problem opening the file, throw an exception and exit - use a try catch statement
//otherwise
//use getline to read data line feed to the instream
//create a circle using the data in the instream
//add the circles to the vector
//keep doing this until all the data in the file is read

}

int main(){


cout<<"The number of circles, using getCount method is "<<//<<endl;
cout<<"The numher of circles, using vetor size method is "<<//<<endl;
//clear vector
cout<<"The number of circles, using getCount method is "<<//<endl;
cout<<"The number of circles remaining is ";

return 0;
}

file "dataLab4.txt" contains:

0 0 4
0 0 6
-2 -9 6
4 5 7
7 8 9

In: Computer Science