Questions
Henry Magruder made a mistake—he left a CD at the coffee station. Later, when Iris Majwubu...

Henry Magruder made a mistake—he left a CD at the coffee station. Later, when Iris Majwubu was topping off her mug with fresh tea, hoping to wrap up her work on the current SQL code module before it was time to go home, she saw the unlabeled CD on the counter. Being the helpful sort, she picked it up, intending to return it to the person who’d left it behind.

Expecting to find perhaps the latest device drivers, or someone’s work from the development team’s office, Iris slipped the disk into the drive of her computer and ran a virus scan on its contents before opening the file explorer program. She had been correct in assuming the CD contained data files, and lots of them. She opened a file at random: names, addresses, and Social Security numbers appeared on her screen. These were not the test records she expected; they looked more like critical payroll data. Concerned, she found a readme.txt file
and opened it. It read:

Jill, see files on this disc. Hope they meet your expectations. Wire money to account as arranged. Rest of data sent on payment.

Iris realized that someone was selling sensitive company data to an outside information
broker. She looked back at the directory listing and saw that the files spanned the range of every department at Sequential Label and Supply—everything from customer lists to shipping invoices. She saw one file that appeared to contain the credit card numbers of every Web customer the company supplied. She opened another file and saw that it only contained about half of the relevant data. Whoever did this had split the data into two parts.

That made sense: payment on delivery of the first half. Now, who did this belong to? She opened up the file properties option on the readme.txt file. The file owner was listed as “hmagruder.” That must be Henry Magruder, the developer two cubes over in the next aisle. Iris pondered her next action.

Iris called the company security hotline. The hotline was an anonymous way to report any
suspicious activity or abuse of company policy, although Iris chose to identify herself. The
next morning, she was called to a meeting with an investigator from corporate security,
which led to more meetings with others in corporate security, and then finally a meeting with
the director of human resources and Gladys Williams, the CIO of SLS.

Questions:
1. Why was Iris justified in determining who the owner of the CD was?
2. Should Iris have approached Henry directly, or was the hotline the most effective way
to take action? Why do you think so?
3. Should Iris have placed the CD back at the coffee station and forgotten the whole
thing? Explain why that action would have been ethical or unethical.

In: Computer Science

PYTHON LANGUAGE Write the data in variable artist_songs into a csv file, 'songs.txt', where the first...

PYTHON LANGUAGE

Write the data in variable artist_songs into a csv file, 'songs.txt', where the first column is singer name and second column is a song name. Each line should have a singer and a song name. Use "Name" and "Song" as headers. Do not include double quotation marks (") in your CSV but you should include apostrophes where necessary (for example, for the song "We Don't Talk Anymore").

In [110]:

artist_songs = {
    'Taylor Swift': ['Love Story', 'You need to Calm Down'],
    'Charlie Puth': ['Attention', "We Don't Talk Anymore", 'Change']
}

In: Computer Science

Write a C program that selects and displays the maximum value of five numbers to be...

Write a C program that selects and displays the maximum value of five numbers to be entered when the program is executed. (Hint : Use a for loop with both a scan_s and if statement inside the loop.)

In: Computer Science

Please use the search engine (Such as google and baidu) to visit four different websites about...

Please use the search engine (Such as google and baidu) to visit four different websites about hotels or scenic spots, describe the features of these sites and multimedia elements.

In: Computer Science

If the items in a list are floats taking 8 memory locations each, compare the amount...

If the items in a list are floats taking 8 memory locations each, compare the amount of space required altogether if (a) the list is kept contiguously in an array 80 percent full (b) the list is kept contiguously in an array 60 percent full and (c) the list is kept as a linked list where the pointers take two memory locations each

In: Computer Science

(Java) Create a program using 3 methods. The methods must be public and static. Ask the...

(Java) Create a program using 3 methods. The methods must be public and static. Ask the user for 3 numbers, then call the methods from main to print max, min, and average.

The first method max (int x, int y, int z) returns the maximum value of 3 integer values.

The second method min (int X, int y, int z) returns the minimum value of 3 integer values.

And the third average (int x, int y, int z) returns the average of 3 integer values.

Sample Output: (bold = user input)

Enter # 1: 5

Enter # 2: 9

Enter # 3: 2

Min is 2

Max is 9

Average is 5.33333

Sample output 2

Enter # 1: 45

Enter # 2: 11

Enter # 3: -3

Min is -3

Max is 45

Average is 17.6667

Code Example:

int addTwoNumbers (int x, int y) {

int result = x + y;

return result;

In: Computer Science

The question: Write a program in Python that writes four random integers in range 1-100 on...

The question: Write a program in Python that writes four random integers in range 1-100 on a file named 'num.txt'. Write try-except block to handle at least two standard python error (any two errors).

Hints:

import random

def main():
    # Local variables

    # Open output file.

    # Write random numbers to the file.

    # Write it on to the file. 

    # Close the file.
    

# Call the main function.
main()

Here is my answer: please let me know if anything is wrong with it. thanks

"

import random

# define the min and max of the random numbers
min = 1
max = 100

def main():


#get four random numbers from 1 to 100 or min to max
number1 = random.randint(min,max)
number2 = random.randint(min,max)
number3 = random.randint(min,max)
number4 = random.randint(min,max)
  
#write TRY/EXCEPT statment
try:

#OPEN a file named num.txt
outfile = open('num.txt', 'w')
  
#WRITE the random numbers to the file
outfile.write(str(number1) + '\n')
outfile.write(str(number2) + '\n')
outfile.write(str(number3) + '\n')
outfile.write(str(number4) + '\n')
  
#PRINT the numbers
print(number1)
print(number2)
print(number3)
print(number4)

  

#write TRY/EXCEPT statment
except ValueError as err:
print(err)

except IOError:
print("An error occured trying to read the file.")


except KeyboardInterrupt:
print("Something went wrong when writing to the file.")
  
except:
print("An error occured.")

finally:
outfile.close()


#call the function
main()


"

In: Computer Science

Use a python code to solve Use Newton interpolation to find the unique polynomial p2(x) of...

Use a python code to solve

Use Newton interpolation to find the unique polynomial p2(x) of degree 2 or less, that agrees with the following data: p2(0) = 1, p2(2) = 5, p2(4) = 17.

In: Computer Science

Create a new Java project, name it “Quiz02”. (This is a JAVA Programming question, thumbs up...

Create a new Java project, name it “Quiz02”. (This is a JAVA Programming question, thumbs up quick and correct answer)

1) Create a java class Traveler that has four data members, String name, Date bDate, int id and int noOfDependens.

Generate the following:

1- Getters and Setters.

2- Four parametrize constructor to initialize the four data members above.

3- toString() method.

Create a java class Flight that has four data members, String number, String destination, int capacity, and ArrayList travelers.

 Note1 - travelers will be used to track the No. of travelers so far on the selected flight.

 Note2 - No. of travelers = No. of dependents + 1;

Generate the following: 1- Getters and Setters.

2- Three parametrize constructor to initialize the number, destination and capacity.

3- toString() method.

4- Method public void addTraveler(Traveler traveler) that will do the following:

a. It will calculate the total No. of travelers so far.

b. It will calculate the total availability = capacity - No. of travelers.

c. If the availability is equal to OR more than the requested tickets (traveler + his noOfDependens) then, accept this reservation and add the traveler to the flight ArrayList, otherwise, reject the reservation by printing the following message “This reservation is NOT accepted. Total No. of requested tickets are: X while the availability is: Y”

d. Sample for your output in case the reservation is accepted is listed below.

Create a java class AppSystem for testing, and include the main method. Then create the following:

Traveler("Traveler1", (17, 5, 1950), 1950517 , 7); Traveler("Traveler2", (2, 12, 1975), 1975122 , 5); Traveler("Traveler3", (13, 3, 1981), 1981313 , 3); Traveler("Traveler4", (9, 10, 1979), 1979109 , 4); Traveler("Traveler5", (25, 5, 1963), 1963525 , 6);    Flight("QAR246", "Kuwait", 70); Flight("Kuw579", "Doha", 60);

5- Add to the Flight QAR246 the first Traveler1 Sample for addTraveler() method after accepting the traveler Traveler1.

Flight capacity: 70

No. of current travelers: 0

Flight availability: 70

=======================================

Accepted reservation. Total No. of reserved tickets are: 8

6- Print the flight QAR246 details by calling the method toString(), sample for your method output listed below:

***** Flight details *****

==========================

Flight No.: QAR246

Flight destination: Kuwait

Flight Capacity: 70

List of travelers:

Traveler name: Traveler1

Birth Date: 17/ 5/1950

ID: 1950517

No. of Dependents: 7

In: Computer Science

In Access, what is the difference between the field size and field width? Are they important?...

In Access, what is the difference between the field size and field width? Are they important? Explain.

In: Computer Science

Use Context-Free Pumping Lemma to prove that that following languages over the alphabet {'x', 'y', 'z'}...

Use Context-Free Pumping Lemma to prove that that following languages over the alphabet {'x', 'y', 'z'} are NOT context-free

(a) {xjy2jzj : j > 0}

(b) { xmynzk : m, n, k ≥ 0 and k = min(m,n) }

In: Computer Science

in this code I have used array two times . I need a way to make...

in this code I have used array two times .

I need a way to make the program functional using a string to store the results and print it again later .

this game should be array free.

import java.util.Scanner;
import java.util.Random;//starter code provided
public class inputLap
{
public static char roller;
public static String playerName;
public static int printed=0;
public static int rounds=8,lives=0,randy;
public static int tries[]=new int[4];//use arrays to store number of tries in each life
public static int res[]=new int[4];
public static String getName(String aString){
Scanner sc= new Scanner(System.in);
System.out.println("enter player's Name:");aString=sc.next();
playerName=aString;
return playerName;
}

public static void menu()
{
Scanner sc= new Scanner(System.in);

if(lives<=4){
System.out.println("Do you want to continue?(y/Y):\n (x/X) to exit. ");roller=sc.next().charAt(0);
}
}

public static int getGame() {
Scanner sc = new Scanner(System.in);
System.out.println("make a guess from 1-20");
int Guessed = sc.nextInt();
return Guessed;
}

public static void main(String[] args) {
String name=getName(playerName);
Random r = new Random();
int answer=0;
int f=0;
while(true) {
randy=r.nextInt(20);
for (int i=0;i<=7;i++)
{
answer=getGame();
rounds--;
if(answer==randy)
{
lives++;
System.out.println("congratulation you are right");
tries[lives-1]=8-rounds;
res[lives-1]=1;
rounds=8;
break;
}
else
{
System.out.println("you have "+(rounds)+" remaining");

}
if(rounds==0){
if(lives!=4){
tries[lives]=8;
lives++;
  
System.out.println("hard luck\nyou have "+(4-lives)+" lives left");
f=1;
}
  
}
if(f==1){
f=0;
break;
}

}

menu();

switch( roller)

{

case 'y':

case 'Y':rounds=8;break;

case'x':

case 'X':

lives=5;
System.out.println("Game No Game 1 Game 2 Game 3 Game 4");
System.out.print("Number of tries ");
printed=1;
for(int i=0;i<4;i++)
System.out.print(tries[i]+" ");
System.out.println();
System.out.print("Result \t");
for(int i=0;i<4;i++){
if(res[i]==1)
System.out.print("Success ");
else
System.out.print("Fail");
}
System.out.println("\nbye bye "+playerName+" !!");

break;

}

if(lives>4)
break;
}

if(printed!=1){
System.out.println("Game No Game 1 Game 2 Game 3 Game 4");
System.out.print("Number of tries ");
for(int i=0;i<4;i++)
System.out.print(tries[i]+" ");
System.out.println();
System.out.print("Result\t");
for(int i=0;i<4;i++){
if(res[i]==1)
System.out.print("Success ");
else
System.out.print("Fail");
}
System.out.println("\nbye bye "+playerName+" !!");

}

}

}

implementing it

In: Computer Science

import java.util.ArrayList; /*     Lab-08: BinarySearchTree Implementation     Rules:         1. Allow Tester to iterate...

import java.util.ArrayList;

/*
    Lab-08: BinarySearchTree Implementation

    Rules:
        1. Allow Tester to iterate through all nodes using the in-order traversal as the default.
            This means, in Tester the following code should work for an instance of this class
            called bst that is storing Student objects for the data:

                BinarySearchTree_Lab08<String> bst = new BinarySearchTree_Lab08<String>();
                bst.add("Man");       bst.add("Soda");   bst.add("Flag");
                bst.add("Home");   bst.add("Today");   bst.add("Jack");

                for(String s : bst)
                    System.out.println(s);

        2.   You can not use a size variable to keep track of the number of nodes
*/


/**
* Lab-08: BinarySearchTree Implementation
*
* @author
*
*/

public class BinarySearchTree_Lab08<T> {
   //====================================================================================== Properties
   private Node root;

   //====================================================================================== Constructors
   public BinarySearchTree_Lab08() {

   }

   // Constructor that takes an array of items and populates the tree
   public BinarySearchTree_Lab08(T[] items) {

   }

   //====================================================================================== Methods
   public void add(T data) {   // Implement recursively and do NOT allow duplicates

   }


   // Returns the traversal of this tree as an array
   public ArrayList<T> preOrder_Traversal() {  
       ArrayList<T> data = new ArrayList<T>();
       preOrder_Traversal(root, data);  
       return data;
   }
   private void preOrder_Traversal(Node n, ArrayList<T> data) {
      
   }

   public ArrayList<T> inOrder_Traversal() {  
       ArrayList<T> data = new ArrayList<T>();
       inOrder_Traversal(root, data);  
       return data;
   }
   private void inOrder_Traversal(Node n, ArrayList<T> data) {
      
   }

   public ArrayList<T> postOrder_Traversal() {  
       ArrayList<T> data = new ArrayList<T>();
       postOrder_Traversal(root, data);  
       return data;  
   }
   private void postOrder_Traversal(Node n, ArrayList<T> data) {
      
   }

   public ArrayList<T> breadthFirst_Traversal() {
       return null;
   }


   // Since this is a binary SEARCH tree, you should write
   // an efficient solution to this that takes advantage of the order
   // of the nodes in a BST. Your algorithm should be, on average,
   // O(h) where h is the height of the BST.
   public boolean contains(T data) {
       return false;
   }

   // returns the smallest value in the tree
   // or throws an IllegalStateException() if the
   // tree is empty. Write the recursive version
   public T min() { return min(root); }       // this method is done for you.      
   private T min(Node n) {   // Write this method.
       return null;
   }

   // returns the largest value in the tree
   // or throws an IllegalStateException() if the
   // tree is empty. Write the recursive version
   public T max() { return max(root); }       // this method is done for you.
   private T max(Node n) {   // Write this method.
       return null;
   }

   // Returns whether the tree is empty
   public boolean isEmpty() {
       return false;
   }

   // returns the height of this BST. If a BST is empty, then
   // consider its height to be -1.
   public int getHeight() {
       return -1;
   }


   // returns the largest value of all the leaves
   // If the tree is empty, throw an IllegalStateException()
   // Note, this is different than max as this is the max
   // of all leaf nodes
   public T maxLeaf() {
       return null;
   }

   // counts the number of nodes in this BST
   public int nodeCount() {
       return -1;
   }

   // returns the "level" of the value in a tree.
   // the root is considered level 0
   // the children of the root are level 1
   // the children of the children of the root are level 2
   // and so on. If a value does not appear in the tree, return -1
   // 15
   // / \
   // 10 28
   // \ \
   // 12 40
   // /
   // 30
   // In the tree above:
   // getLevel(15) would return 0
   // getLevel(10) would return 1
   // getLevel(30) would return 3
   // getLevel(8) would return -1
   public int getLevel(T n) {
       return -1;
   }


   // A tree is height-balanced if at each node, the heights
   // of the node's two subtrees differs by no more than 1.
   // Special note about null subtrees:
   // 10
   // \
   // 20
   // Notice in this example that 10's left subtree is null,
   // and its right subtree has height 0. We would consider this
   // to be a balanced tree. If the tree is empty, return true;
   public boolean isBalanced() {
       return false;
   }


   //====================================================================================== Inner Node Class
   private class Node {
       private T data;
       private Node left, right;

       private Node(T data) {
           this.data = data;
           left = right = null;
       }
   }
}

In: Computer Science

List and explain in detail all the steps that will be performed to convert a logical...

List and explain in detail all the steps that will be performed to convert a logical address to physical address in the paging system?

In: Computer Science

(JAVA) Create a program that creates a mini database of numbers that allows the user to:...

(JAVA)

Create a program that creates a mini database of numbers that allows the user to: reset the database, print the database, add a number to the database, find the sum of the elements in the database, or quit.

In main, you will declare an array of 10 integers (this is a requirement). Then you will define the following methods: • printArray (int[ ] arr) – this takes in an array and prints it • initArray (int[ ] arr) – this initializes the array so that each cell is 0 • printSum (int[ ] arr) – this calculates the sum of the elements in the array and prints it • enterNum(int[ ] arr) – this asks the user for a slot number and value – putting the value into the array in the correct slot • printMenu (int[ ] arr) – prints the menu in the sample output (that’s it, nothing more)

In main, create an array of 10 integers and immediately call initArray( ). Then, continuously looping, print the menu and ask the user what they want to do – calling the appropriate methods based on the user’s choice. Note that every time you call a method, you must pass the array that was created in main. If it makes it easier, we used a do-while loop and a switch statement in main.

It should behave like the sample output below: (user input = bold)

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

1

Enter the slot: 5

Enter the new value: 76

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

1

Enter the slot: 2

Enter the new value: 33

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

2

|0|0|33|0|0|76|0|0|0|0

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

3

109

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

4

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

2

|0|0|0|0|0|0|0|0|0|0

Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

5

In: Computer Science