Questions
Explain how/why data mining and web mining respectively pose a threat to both individual and group...

Explain how/why data mining and web mining respectively pose a threat to both individual and group privacy. Why does it matter? List at least three privacy-enhancement technologies (PETS) that exist to protect users and how/whether they work

In: Computer Science

For Homework 4, we are going to present the user with a series of menus, accept...

For Homework 4, we are going to present the user with a series of menus, accept as input the action they wish to take, and act appropriately. You must practice basic input validation to ensure that the menu option they chose is valid.

  1. Create “CPS132 Homework 4” project in Eclipse
  2. Create “Homework4.py” file
  3. Download "Homework4_incomplete.py"
  4. Paste the text into "Homeworkpy"
  5. Make sure to fill in the appropriate information in the header including your name, username, due date, Homework #4, and the Bug Report
  6. Use the comments and hints to complete the assignment
  7. Sample input and output on Windows 10
    1. This is homework 4 incomplete
      1. #*****************************************************************************
        # Name:
        # User name:
        # Homework No: 4
        # Date Due:    3/26/2019
        #
        # Description:
        #   A brief but complete description of what the program does
        #
        # Bug Report:
        #   A description of the known bugs in the program you could not fix.
        #   If you did not implement specific functionality, that should be reported
        #   in this section as well
        #*****************************************************************************
        import platform
        import webbrowser
        
        def mainMenu():
            # output main menu to user
            print("\n")
            
            
            # get input from user
            
        
            # take appropriate action based on the user input
            # Hint: call openWebsite() or getComputerInfo() when appropriate
            
        
        def openWebsite():
            # output web sites menu to user
            print("\n")
            
        
            # get input from user
            
        
            # take appropriate action based on the user input
            # Look at https://docs.python.org/2/library/webbrowser.html
            # We want to open the appropriate web page in a new browser tab
            # Hint: use webbrowser.open_new_tab(url)
            
            # The URLs are the following:
            # UD: http://www.udayton.edu
            # BCM: http://catalog.udayton.edu/undergraduate/collegeofartsandsciences/programsofstudy/chemistry/#BCM
            # CHM: http://catalog.udayton.edu/undergraduate/collegeofartsandsciences/programsofstudy/chemistry/
            # CME: http://catalog.udayton.edu/undergraduate/schoolofengineering/programsofstudy/chemicalandmaterialsengineering/#MAJOR
            # EAS: http://catalog.udayton.edu/allcourses/edt/
            # ECT: http://catalog.udayton.edu/allcourses/ect/
            # ERL: https://udayton.edu/education/departments_and_programs/edt/programs/undergraduate/erl/index.php
            # EYA: https://udayton.edu/education/departments_and_programs/edt/programs/undergraduate/eya/index.php
            # GEO: http://catalog.udayton.edu/undergraduate/collegeofartsandsciences/programsofstudy/geology/#GEO
            # MCT: http://catalog.udayton.edu/allcourses/mct/
            # MEE: http://catalog.udayton.edu/allcourses/mee/
            # MTH: http://catalog.udayton.edu/allcourses/mth/
            # PHY: http://catalog.udayton.edu/allcourses/phy/
        
            
        def getComputerInfo():
            # output computer info menu to user
            print("\n")
            
        
            # get input from user
            
        
            # take appropriate action based on the user input
            # Look at https://docs.python.org/2/library/platform.html for the list of functions which perform the necessary actions
            # Use the appropriate functions in the section "15.15.1. Cross Platform"
        
        # call the mainMenu() function
        mainMenu()

In: Computer Science

Write code in Python: The edge-detection function (detectEdges) described in Chapter 7 and shown below returns...

Write code in Python:

The edge-detection function (detectEdges) described in Chapter 7 and shown below returns a black and white image. Think of a similar way to transform color values so that the new image is still in its original colors but the outlines within it are merely sharpened.

Then, define a function named sharpen that performs this operation. The function should expect an image and two integers as arguments. One integer should represent the degree to which the image should be sharpened. The other integer should represent the threshold used to detect edges.

(Hint: A pixel can be darkened by making its RGB values smaller.)

Example:

def detectEdges(image, amount):
    """Builds and returns a new image in which the edges of
    the argument image are highlighted and the colors are
    reduced to black and white."""
    def average(triple):
        (r, g, b) = triple
        return (r + g + b) // 3

    blackPixel = (0, 0, 0)
    whitePixel = (255, 255, 255)
    new = image.clone()
    for y in range(image.getHeight() - 1):
        for x in range(1, image.getWidth()):
            oldPixel = image.getPixel(x, y)
            leftPixel = image.getPixel(x - 1, y)
            bottomPixel = image.getPixel(x, y + 1)
            oldLum = average(oldPixel)
            leftLum = average(leftPixel)
            bottomLum = average(bottomPixel)
            if abs(oldLum - leftLum) > amount or \
                abs(oldLum - bottomLum) > amount:
                new.setPixel(x, y, blackPixel)
            else:
                new.setPixel(x, y, whitePixel)
    return new

In: Computer Science

In your LAN, you want to allow the external host to communicate only with your internal...

In your LAN, you want to allow the external host to communicate only with your internal Telnet server (TCP / 23). External hosts are not allowed to establish TCP connection with other internal servers. Write the appropriate filtering rules for the security policy. [15 points]

Required fields for the filtering rule:

RuleID, SourceIP, DestIP, SourcePort, DestPort, Protocol, SYN, ACK, Action

In: Computer Science

Assume that the firewall in question A) is a stateless firewall. Give an example of a...

Assume that the firewall in question A) is a stateless firewall. Give an example of a packet that will be accepted by this firewall, but the same packet would be rejected if the firewall was stateful.

In: Computer Science

You are required to develop a utility for uploading a file in .rar, .zip and .pdf...

You are required to develop a utility for uploading a file in .rar, .zip and .pdf format using the reusable code of PHP from any online resources. To do this assignment you need to use the FILE element of html forms and on submission the next page should include the php code for completing the operation of file upload. You can use file directories, databases for maintaining your files at your web server along with your web application.

In: Computer Science

Rewrite this code of a game of Moropinzee so that it works as intended without the...

Rewrite this code of a game of Moropinzee so that it works as intended without the "break;" in the last few lines of the code.

Code:

import java.util.*;

public class Moropinzee

{

public static void main(String[] args)
{

Scanner sc = new Scanner(System.in);

while(true)

{

System.out.println("Player 1 enter a number 1-5 for Monkey, Robot, Pirate, Ninja, or Zombie:");

int p1 = sc.nextInt();

while(p1<1 || p1>5)

{

System.out.println("Invalid choice, Player 1. Enter a number 1-5:");

p1 = sc.nextInt();

}

System.out.println("Player 2 enter a number 1-5 for Monkey, Robot, Pirate, Ninja, or Zombie:");

int p2 = sc.nextInt();

while(p2<1 || p2>5)

{

System.out.println("Invalid choice, Player 2. Enter a number 1-5:");

p2 = sc.nextInt();

}

if((p1==1 && p2==4)||(p1==4 && p2==1))

{

System.out.print("Monkey fools Ninja. ");

if(p1==1)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==1 && p2==2)||(p1==2 && p2==1))

{

System.out.print("Monkey unplugs Robot. ");

if(p1==1)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==2 && p2==4)||(p1==4 && p2==2))

{

System.out.print("Robot chokes Ninja. ");

if(p1==2)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==2 && p2==5)||(p1==5 && p2==2))

{

System.out.print("Robot crushes Zombie. ");

if(p1==2)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==3 && p2==2)||(p1==2 && p2==3))

{

System.out.print("Pirate drowns Robot. ");

if(p1==3)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==3 && p2==1)||(p1==1 && p2==3))

{

System.out.print("Pirate skewers Monkey. ");

if(p1==3)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==4 && p2==3)||(p1==3 && p2==4))

{

System.out.print("Ninja karate chops Pirate. ");

if(p1==4)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==4 && p2==5)||(p1==5 && p2==4))

{

System.out.print("Ninja decapitates Zombie. ");

if(p1==4)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==5 && p2==3)||(p1==3 && p2==5))

{

System.out.print("Zombie eats Pirate. ");

if(p1==5)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if((p1==5 && p2==1)||(p1==1 && p2==5))

{

System.out.print("Zombie savages Monkey. ");

if(p1==1)

{

System.out.println("Player 1 wins!");

}

else

{

System.out.println("Player 2 wins!");

}

}

else if(p1 == p2)

System.out.println("Nobody wins");

System.out.println("Would you like to play again?");

sc.nextLine();//goto next line

String s = sc.nextLine();//take input from user

if((s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y")) == false)

break;

}

System.out.println("Thanks for playing!");

}

}

In: Computer Science

Write a MIPS program to check if computer is a big-endian or little-endian system. This must...

Write a MIPS program to check if computer is a big-endian or little-endian system. This must be done in MIPS assembly language.

In: Computer Science

Please take this c++ code and make it into java code. /* RecursionPuzzleSolver * ------------ *...

Please take this c++ code and make it into java code.

/* RecursionPuzzleSolver

* ------------

* This program takes a puzzle board and returns true if the

* board is solvable and false otherwise

*

* Example: board 3 6 4 1 3 4 2 5 3 0

* The goal is to reach the 0. You can move the number of spaces of your

* current position in either the positive / negative direction

* Solution for this game is +3, -1, +4, +2, -3, +4

*/

#include <iostream>

#include <vector> // for vector

using namespace std;



/* Solvable

* --------

* Solvable returns true if there is a solution to the puzzle

* false otherwise.

*

*/

bool Solvable(int start, vector<int> & squares){

if (squares[start] == 0) return true;

else{

int nextForward = start + squares[start];

int nextBackward = start - squares[start];

if( nextForward<=squares.size()-1 && nextBackward>=0 ){

return ( Solvable(nextForward, squares) || Solvable(nextBackward,squares) );

}

if ( nextForward>squares.size()-1 && nextBackward>=0) {

return ( Solvable(nextBackward, squares));

}

if (nextForward<=squares.size()-1 && nextBackward<0 && squares[start]!=squares[nextForward]){

return ( Solvable(nextForward, squares));

}

if ( squares[start] == squares[nextForward] &&

nextBackward<0 &&

nextForward+squares[nextForward]>squares.size()-1){

return false;

}

else return false;

}

}

/* boolToString

* --------

* boolToString returns string "true" if the argument is true or 1

* returns string "false" otherwise

*

*/

string boolToString(bool boolean){

if(boolean)

{

return "true";

}

else

{

return "false";

}

}

int main(){

vector<int> puzzle1 {3, 6, 4, 1, 3 ,4, 2, 5, 3, 0};

vector<int> puzzle2 {3, 1, 2, 3, 0};

vector<int> puzzle3 {1,0};

vector<int> puzzle4 {1, 3, 2, 2, 1, 0};

cout << boolToString( Solvable(0, puzzle1) ) << endl; // true

cout << boolToString( Solvable(0, puzzle2) ) << endl; // false

cout << boolToString( Solvable(0, puzzle3) ) << endl; // true

cout << boolToString( Solvable(0, puzzle4) ) << endl; // true

return 0;

}

In: Computer Science

A) What is the big O for the following: f(n)=5n2+logn+1 i)n^2 ii)1 iii)logn iv)5n2+logn+1 B) Given...

A) What is the big O for the following:

f(n)=5n2+logn+1

i)n^2

ii)1

iii)logn

iv)5n2+logn+1

B) Given two algorithms with the following running time:Algorithm

A: Ta(n)=4n+20 andAlgorithm

B: Tb(n)=2n2+10Which of the following statements are correct?

i)Algorithm A is faster than algorithm B for n > 100.

ii)Algorithm B is faster than algorithm A for n > 100.

C) A function template can operate with:

i)an integer

ii)any type of data

iii)a string

iv)a Rectangle object

In: Computer Science

11.7: Customer Accounts Write a program that uses a structure to store the following data about...

11.7: Customer Accounts
Write a program that uses a structure to store the following data about a customer account:

     Customer name
     Customer address
     City
     State
     ZIP code
     Telephone
     Account balance
     Date of last payment

The program should use an array of at least 20 structures. It should let the user enter data into the array, change the contents of any element, and display all the data stored in the array. The program should have a menu-driven user interface.

Prompts And Output Labels. Your main menu should be the following:
     1. Enter new account information
     2. Change account information
     3. Display all account information
     4. Exit the program
The user is expected to enter 1 or 2 or 3 or 4.
The main menu is displayed at the start of the program and after the handling of choices 1, 2, and 3.

If 1 is entered for the main menu, the program prompts for each of the data listed above, in the order listed above, using the above data descriptions (e.g. "ZIP code") as prompts (followed in each case by a colon). After reading in and processing the data, the program prints
     You have entered information for customer number X
where X is the customer number: 0 for the first customer and increasing by 1 for each subsequent customer that is entered.

If 2 is entered for the main menu, the program prompts for the customer number:
     Customer number:
Upon entering a valid customer number the program displays all the data for the particular customer that has been saved:
     Customer name: ...
     Customer address: ...
     City: ...
     State: ...
     ZIP code: ...
     Telephone: ...
     Account balance: ...
     Date of last payment: ...

The program then skips one or two lines and prompts for a change, using the same prompts as in choice 1 above for all the data items associated with a customer.

If 3 is entered for the main menu, the program displays all the data for each customer that has been saved, using the display format in choice 2 above. After the display of each customer, the program prompts "Press enter to continue..." and waits for the user to hit return.

If 4 is entered for the main menu, the program terminates.

Input Validation (OPTIONAL). When the data for a new account is entered, be sure the user enters data for all the fields. No negative account balances should be entered.

In: Computer Science

Joe, Sally, Bill, and Ellen are the only members of the club. Joe is married to...

Joe, Sally, Bill, and Ellen are the only members of the club.

Joe is married to Sally.

Bill is Ellen’s brother.

The spouse of every married person in the club is also in the club.

From the paragraph, many people could conclude that Ellen is not married.

[Hint] The properties of equality can be used.

1) Represent the above sentences into FOL(First Order Logic) with your ontology.

2) For many people for to conclude that Ellen is not married, what knowledge must be added to the knowledge base? Give the additional FOL formulas.

3) Using the augmented knowledge base, prove that Ellen is not married by refutation-resolution.

In: Computer Science

Write a class Lab7 that reads and evaluates postfix expressions contained in a file. Each line...

Write a class Lab7 that reads and evaluates postfix expressions contained in a file. Each line of the file contains a postfix expression with integers as operands and ‘+’, ‘-’, ‘*’ and ‘/’ as operators. Consecutive operands and operators are separated by spaces. Note the following requirements for the lab: • The main method in Lab7.java should do the following. 1. ask the user for the name of the file containing the expressions, 2. for each line of the file, read the postfix expression, call the method evaluatePostfix on this expression, and print the expression and its evaluation on the console. • The method to evaluate the postfix expression in Lab7.java must have the following signature: public static int evaluatePostfix(String expr). Your implementation must use the Scanner class to parse each line of the file to obtain the postfix expressions and then use a stack to evaluate each of these expressions. Test your code using lab7.dat as your input data file. You will also need the following files : StackInterface.java, StackArrayListBased.java, StackException.java

/** Implementation of a Stack Class using an ArrayList; we consider the
 * top of the stack to be the first element in the ArrayList. Hence a
 * push adds an element in the front of the vector, and a
 * pop removes the first element of the vector.
 * @authors Sharmin Jahan, Sandip Sen
 */
import java.util.ArrayList;

public class StackArrayListBased implements StackInterface {
    /** ArrayList used for the stack */
    private ArrayList stack;

    /** default constructor */
    public StackArrayListBased() {
        stack = new ArrayList();
    }  // end default constructor


    /** Tests if this stack has no elements.
     * @return true if this list has no elements;
     * false otherwise.
     */
    public boolean isEmpty() {
        return stack.isEmpty();
    }  // end isEmpty


    /** Adds an item to the top of a stack.
     *Postcondition: If insertion is successful, newItem is on the top
     * of the stack
     * @param newItem is the item to be added.
     * @throws some implementations may throw StackException when
     * newItem cannot be placed on the stack.
     */
    public void push(E newItem) throws StackException {
        stack.add(0, newItem);
    }  // end push

    /**
     * Removes all the items from the stack.
     * PostCondition: Stack is empty.
     */
    public void popAll() {
        stack.clear();
    }  // end popAll

    /**
     * Removes the top of a stack.
     * @return If the stack is not empty, the item that was added most
     * recently is removed from the stack and returned.
     * @throws StackException if the stack is empty.
     */
    public E pop() throws StackException {
        if (!isEmpty()) {
            return stack.remove(0);
        }
        else {
            throw new StackException("StackException on " +
                    "pop: stack empty");
        }  // end if
    }  // end pop

    /**  Retrieves the top of a stack.
     * @return If the stack is not empty, the item that was added most
     * recently is returned. The stack is unchanged.
     * @throws StackException if the stack is empty.
     */
    public E peek() throws StackException {
        if (!isEmpty()) {
            return stack.get(0);
        }
        else {
            throw new StackException("Stack exception on " +
                    "peek - stack empty");
        }  // end if
    }  // end peek
}  // end StackArrayListBased
/** Generic Stack Interface */
public interface StackInterface {

    /** Determines whether the stack is empty.
     * @return true if the stack is empty; false otherwise
     */
    public boolean isEmpty();
    
    /**
     * Removes all the items from the stack.
     * PostCondition: Stack is empty.
     */
    public void popAll();
    
    /** Adds an item to the top of a stack.     
     *Postcondition: If insertion is successful, newItem is on the top
     * of the stack
     * @param newItem is the item to be added.
     * @throws Some implementations may throw StackException when
     * newItem cannot be placed on the stack.
     */
    public void push(E newItem) throws StackException;

    /**
     * Removes the top of a stack.
     * @return If the stack is not empty, the item that was added most
     * recently is removed from the stack and returned.
     * @throws StackException if the stack is empty.
     */
    public E pop() throws StackException;
  
  
    /**  Retrieves the top of a stack.  
     * @return If the stack is not empty, the item that was added most
     * recently is returned. The stack is unchanged.
     * @throws StackException if the stack is empty.
     */
    public E peek() throws StackException;
 
    

}  // end StackInterface
public class StackException 
             extends java.lang.RuntimeException {
  public StackException(String s) {
    super(s);
  }  // end constructor
}  // end StackException

lab7.dat

5 4 - 12 - 10 62 + /
10 7 * 43 - 15 / 17 39 - +
22 11 / 19 * 14 2 + 2 * -
40 3 * 66 - 5 / 29 +

In: Computer Science

After running the experiment with the pivot, comment out the line, update the pivot selection to...

After running the experiment with the pivot, comment out the line, update the pivot selection to use the median of the first, middle, and last items, and run the experiment.

What line needs to be commented out and how would I update the pivot selection to use the median?

Example.java

package sorting;

import java.io.IOException;
import java.util.Random;
import sorters.QuickSort;

public class Example {

   public static void main(String args[]) throws IOException {
       int n = 100;   // adjust this to the number of items to sort
       int runs = 11;
      
       
       partB(n, runs);


   public static void partB(int n, int runs) {
       int [] data = new int[n];
       QuickSort quicksort = new QuickSort();
      
       labels(runs);
       for (int i = 0; i < runs; i++) {
           randomArray(data);
           quicksort.sort(data);
       }
       System.out.println();
      
   }
  
   public static void labels(int runs) {
       for(int i = 0; i < runs; i++) {
           String label = "Run " + i;
           System.out.printf("%12s ", label);
       }
       System.out.println();      
   }
  
   public static void randomArray(int [] data) {
       Random rand = new Random();      
       for(int j = 0; j < data.length; j++) {
           data[j] = rand.nextInt();
       }  
   }
  
}

QuickSort.java

package sorters;

// note that this class can only sort primitive ints correctly.

public class QuickSort {
  
   private int[] items;
  
   public void sort(int[] items) {
       this.items = items;
      
       long start = System.nanoTime();
       quicksort(0, items.length-1);
       long finish = System.nanoTime();
       //System.out.println(Arrays.toString(items));
       System.out.printf("%12s ", finish-start);
   }
  
   private int partition(int left, int right) {
       int i = left;
       int j = right;
        int temp;
        int pivot = (int) items[(left + right) / 2];
      
      
        while (i <= j) {
           while((int) items[i] < pivot)
               i++;
            while((int) items[j] > pivot)
                j--;
            if(i <= j) {
                temp = items[i];
                items[i] = items[j];
                items[j] = temp;
                i++;
                j--;
            }
        }
        return i;
   }

   private void quicksort(int left, int right) {

       int index = partition(left, right);

        if(left < index - 1)
           quicksort(left, index-1);
        if(index < right)
            quicksort(index, right);
   }
}

In: Computer Science

Course: Big Data Processing In your opinion, what are the advantages and disadvantages of implementing a...

Course: Big Data Processing

In your opinion, what are the advantages and disadvantages of implementing a hadoop deployment between Virtualization, Private Cloud and Public Cloud?

In: Computer Science