Questions
For the division method for creating hash functions, map a key k into one of m...

For the division method for creating hash functions,

map a key k into one of m slots by taking the remainder of k divided by m. The hash function is:

                        h(k) = k mod m,

            where m should not be a power of 2.

For the Multiplication method for creating hash functions,

            The hash function is h(k) = m(kA – k A ) = m(k A mod 1)

            where “k A mod 1” means the fractional part of k A; and a constant A in the range

0 < A < 1.

An advantage of the multiplication method is that the value of m is not critical.

Choose m = 2p for some integer p.

Give your explanations for the following questions:

(1) why m should not be a power of 2 in the division method for creating hash function; and

            (2) why m = 2p, for some integer p, could be (and in fact, favorably) used.

In: Computer Science

11. A business rule says that an employee cannot earn more than his/her manager. Assume that...

11. A business rule says that an employee cannot earn more than his/her manager.
Assume that each employee row has a foreign key which refers to a manger row.
a. Can this business rule be implemented using a fixed format constraint?
b. Can this business rule be implemented using a trigger?
12. Triggers should be created sparingly. Why?
13. Should you use a trigger to check the uniqueness of a primary key?

14. What is a Distributed Database system?
15. What advantages does a Distributed Database have over a Centralized Database?
16. Why do some users require data from multiple sites in a Distributed Database?

17. What is Horizontal Fragmentation within a DDBMS?

Note: Questions are based on DBMS (Distributed database and triggers)

In: Computer Science

You have a class named AirConditioner that has a private boolean field named on. It has...

You have a class named AirConditioner that has a private boolean field named on. It has method named turnOn that sets the field to true and one named turnOff that set it to false. It also has a method named isOn that returns the value of the on field. Fill in the blank to complete the turnOff method.

public void turnOff() {
    ______________________
}

In: Computer Science

Give an example that shows the greedy algorithm for activity selection that picks the activity with...

Give an example that shows the greedy algorithm for activity selection that picks the activity with the smallest start time first (and continues in that fashion) does not solve the activity selection problems correctly.

Please show your work! I will rate quality answers. Thank you.

In: Computer Science

1. Copy the files from Assignment 1 to Assignment 3. 2. Modify the PetFoodCompany header to...

1. Copy the files from Assignment 1 to Assignment 3.

2. Modify the PetFoodCompany header to mention a friend function called "computeBonusBudget". This method should compute the bonus budget as netIncome() * BonusBudgetRate and this method should exist in the driver program - not the Class defintion.

3. Modify the output of the program to display the results of the computeBonusBudget.

Enter Total Sales: 1000
Enter Total Expenses: 600
Net Income = 400
Bonus Budget = 8

Here is the code:

PetFoodComp.h:

class PetFoodCompany
{
public:
  
PetFoodCompany();

char getQuart();
char* getCompany();
char* getDivision();

void setQuart(char quart);
void setTotalSales(float totalSales1);
void setTotalExpences(float totalExpences1);
void setCompany(char name[]);
void setDivision(char name1[]);


float getTotalSales();
float getTotalExpences();

double netIncome();
  

private:
  
char company[40];
char division[40];

static char quart;
static double BonusRate;

float totalSales;
float totalExpences;
  
  
};

PetFood.cpp:

#include <iostream>
#include <cstring>
#include "PetFoodComp.h"

using namespace std;


double PetFoodCompany::BonusRate = 0.02;
char PetFoodCompany::quart = '1';

PetFoodCompany::PetFoodCompany()
{
   strcpy(company, "myCompanyName");
}

char PetFoodCompany::getQuart()
{
   return quart;
}

float PetFoodCompany::getTotalSales()
{
   return totalSales;
}

float PetFoodCompany::getTotalExpences()
{
   return totalExpences;
}

char* PetFoodCompany::getCompany()
{
   return company;
}

char* PetFoodCompany::getDivision()
{
   return division;
}

void PetFoodCompany::setQuart(char quart1)
{
   if (quart1 == '1' || quart1 == '2' || quart1 == '3' || quart1 == '4')
       quart = quart1;
}

void PetFoodCompany::setTotalSales(float totalSales1)
{
   totalSales = totalSales1;
}

void PetFoodCompany::setTotalExpences(float totalExpences1)
{
   totalExpences = totalExpences1;
}

void PetFoodCompany::setCompany(char name[])
{
   strcpy(company, name);
}

void PetFoodCompany::setDivision(char dname[])
{
   strcpy(division, dname);
}

double PetFoodCompany::netIncome()
{
   return (totalSales - totalExpences);
}

PetFoodMain.cpp:

#include <iostream>
#include <cstring>
#include "PetFoodComp.h"


using namespace std;

int main()
{
   double totalSales, totalExpences;
   PetFoodCompany pet;
   cout << "Company Name is " << pet.getCompany() << "\n";
   cout << "Current Quarter is " << pet.getQuart() << "\n";


   cout << "Enter Total Sales: ";
   cin >> totalSales;

   cout << "Enter Total Expences: ";
   cin >> totalExpences;

   pet.setTotalExpences(totalExpences);
   pet.setTotalSales(totalSales);

   cout << "Net Income: " << pet.netIncome() << "\n";

   return 0;
}

In: Computer Science

Question 2. A programmer has to develop an instant messaging app used in mobile phone. He...

Question 2.
A programmer has to develop an instant messaging app used in mobile phone. He is considering the computer instruction set architecture of either RISC or CISC and the programming method of either translation or interpretation.
(a) Suggest and justify the most suitable instruction set architecture.
(b) Suggest and justify the most suitable programming method

In: Computer Science

Write a PL/SQL program that prints following: if sum of its digits raised to the power...

Write a PL/SQL program that prints following: if sum of its digits raised to the power n is equal to number itself, where n is total digits in number.

If the Input is: 129, then output of the program will be: 738

In: Computer Science

Database questions: USE THE FOLLOWING SQL CODE TO SOLVE NEXT QUESTIONS: CREATE TABLE ROBOT ( Serial_no...

Database questions:
USE THE FOLLOWING SQL CODE TO SOLVE NEXT QUESTIONS:
CREATE TABLE ROBOT
(
Serial_no INT NOT NULL,
Model VARCHAR(20) NOT NULL,
Manufacturer VARCHAR(20) NOT NULL,
Price INT NOT NULL,
PRIMARY KEY (Serial_no)
);
INSERT INTO ROBOT VALUES (1, 'Scara','Epson', 23200);
INSERT INTO ROBOT VALUES (2, 'ASSISTA','Mitsubishi', 17500);
INSERT INTO ROBOT VALUES (3, 'Lego Mindstorm','NXT', 650);
INSERT INTO ROBOT VALUES (4, 'Yumi','ABB', 40000);
INSERT INTO ROBOT VALUES (5, 'Pepper','Foxconn', 1600);
INSERT INTO ROBOT VALUES (6, 'Humanoid','Honda', 30000);
SELECT * FROM ROBOT ;
/*===================================================*/
CREATE TABLE OPTIONS
(
Serial_Num INT NOT NULL,
Option_name VARCHAR(20) NOT NULL,
Price INT NOT NULL,
PRIMARY KEY (Serial_num, Option_name),
FOREIGN KEY (Serial_num) REFERENCES ROBOT(Serial_no)
);
INSERT INTO OPTIONS VALUES (1, 'Self power', 10000);
INSERT INTO OPTIONS VALUES (1, 'Sense surrounding', 20000);
INSERT INTO OPTIONS VALUES (5, 'Extra Speed', 30000);
INSERT INTO OPTIONS VALUES (2, 'Self power', 40000);
INSERT INTO OPTIONS VALUES (3, 'Motion Balance', 50000);
INSERT INTO OPTIONS VALUES (4, 'Custom look', 60000);
SELECT * FROM OPTIONS;
/*===================================================*/
CREATE TABLE SALESPERSON
(
Salesperson_id INT NOT NULL,
SName VARCHAR(20) NOT NULL,
Phone VARCHAR(20) NOT NULL,
PRIMARY KEY (Salesperson_id)
);
INSERT INTO SALESPERSON VALUES (111, 'Jameco Electronics', '0252354565');
INSERT INTO SALESPERSON VALUES (222,'RobotShop', '0231236455');
INSERT INTO SALESPERSON VALUES (333,'RoboRealm', '0287678790');
SELECT * FROM SALESPERSON ;
/*===================================================*/​
CREATE TABLE SALE
(
Salesperson_id INT NOT NULL,
Serial_no INT NOT NULL,
MyDate DATE NOT NULL,
Sale_Price INT NOT NULL,
PRIMARY KEY (Salesperson_id, Serial_no),
FOREIGN KEY (Salesperson_id) REFERENCES SALESPERSON (Salesperson_id),
FOREIGN KEY (Serial_no) REFERENCES ROBOT(Serial_no)
);
INSERT INTO SALE VALUES (111, 1, DATE'2018-9-23', 22000);
INSERT INTO SALE VALUES (222, 1, DATE'2019-9-22', 21400);
INSERT INTO SALE VALUES (111, 4, DATE'2017-7-21', 37000);
INSERT INTO SALE VALUES (333, 3, DATE'2020-6-14', 470);
SELECT * FROM SALE ;


Q1: Write a query to display all serial numbers of robots that don’t have sales using complex queries

Q2: Write a query that displays the sales price and dynamically assign a deal category to it as follows:
- If the sales price less than or equal 10,000 à accepted-deal price
- If the sales price ranges between 20,000 and 25,000 à average-deal price
- If the sales price greater than 50,000 à rejected-deal price


In: Computer Science

Using matlab Set ASIZE to 5. Write a program that creates an array of ASIZE numeric...

Using matlab

  1. Set ASIZE to 5. Write a program that creates an array of ASIZE numeric elements. Prompt the User for ASIZE numbers and store them in the array. After storing the values, calculate the sum of all the values in the array and display the sum.
  2. Modify the program you wrote for Problem 5 such that it calculates the product of all the values instead of the sum.
  3. Modify the program you wrote in Problem 6 such that it changes the value of each element of the array by multiplying each element of the array by 2, and then displays each element of the array.

                                                                                                              

In: Computer Science

Grocery Store using Java Arraylist Requirements: 1. Need Product Class and Stock Class 2. Use arraylist...

Grocery Store using Java Arraylist Requirements:

1. Need Product Class and Stock Class

2. Use arraylist to store/ add product in stock

3. Product must have name, code number and quantity in stock

4. Print list of the products and their stock quantity

5. Search products based on their name

6. Remove product based on their code number

7. Sell product and deduct quantity from stock

8. Stock Class contains methods of search product, add product and check quantity of the product

9. Product Class contains method of get product details

In: Computer Science

I need new and unique answers, please. (Use your own words, don't copy and paste), Please...

I need new and unique answers, please. (Use your own words, don't copy and paste),

Please Use your keyboard (Don't use handwriting) Thank you..

IT101

Q1:Data Modelling is the primary step in the process of database design. Compare and contrast Conceptual data model versus Physical data model. Illustrates with help of example to list down data (entities), relationship among data and constraints on data.

Q2:What strategic competitive benefits do you see in a company’s use of extranets?

Q3:Explain how Internet technologies are involved in developing a process in one of the functions of the business? Give an example and evaluate its business value.

Q4:

What are the basic differences between HRM, Intranet and Internet in terms of Domain and Network Communication Scope?

HRM Intranet

HRM Internet

Domain

Network Communication Scope

In: Computer Science

python { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "<center> <h1>CpE 4040 Midterm-2 Exam</h1>...

python

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<center> <h1>CpE 4040 Midterm-2 Exam</h1> </center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1- Write a Python code which asks two numbers from the user, calculates the sum and print the result. Create a function to calculate the summation and return the result value.<br>\n",
"i.e. <br>\n",
"First Number:12 <br>\n",
"Second Number:23 <br>\n",
"12 + 23 = 35"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2- Create 20 random integers in an array which has the numbers between 10 and 100 (includes 10 and 100). Sort and print the numbers in descending order."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3- Write a Python code that asks a string from the user and prints only the lower case letters in that string."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"4- Create an evenly spaced 21-element array between 2.2 and 12.4. Find the median of the array. Print both the array and median value. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"5- Write a simple number guessing game Python program. In this code, generate a random integer between 1-10 (both included) and ask the user to guess the number in three attempts. \n",
"Print appropriate responses to the user such as \"You won!\" or \"You failed\" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"6- Generate an array of numbers from 1 to 15. Reshape it to make 3x5 matrix. Convert the matrix into data frame and print the even number of columns. "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

In: Computer Science

Discuss this statement; “Banking everywhere, but not at the bank”. * (10 Marks

Discuss this statement; “Banking everywhere, but not at the bank”. *

(10 Marks

In: Computer Science

PHP You will be using the object oriented features of PHP to design a music album...

PHP

You will be using the object oriented features of PHP to design a music album processing page.

First you will build a form page called addAlbum.php. This form will contain text fields for album title, artist, publisher (Sony, BMI, etc.) and genre. Add two more fields of your choice. You will post this form to the file process.php.

If all the fields have values, we will create a new Album object and print the details of the object. You will need to create an Album class that has private instance variables for all the fields just described. Your constructor should simply echo to the screen "Album created." If the user missed some of the form, give them a link to go back and fix.

Generate standard getters/setters

You will need to create __get and __set functions (magic functions) to allow us to set the properties of the instance variables from outside the class. You will also create a function (or method) called __toString() in the class. Calling this will return a formatted string of all the details for the album. Store the class in album.class.php.

Include a hyperlink back to add another album.

Sample output could look like this:

Album Created
Album Title: Blaze of Glory
Artist: Jon Bon Jovi
Publisher: ASCAP
Genre: Rock
Custom Field: stuff
Another Custom Field: stuff

Add another album! (This is an hyperlink to add another album)

Requirements

i. Comments on all pages, proper page names (as requested), aligned code, overall effort
ii. addAlbum.php page is complete - doctype, complete html structure and some instructions that give the user some indication of what they are to do
iii. album.class.php - contains code to define album class - as well as documentation/comments to outline how to use - see requirements for details (private vars, constructor, magic methods(__get(),__set() and __toString functions)
iv. Some type of validation used so that user knows about errors
v. Styles for all pages: Use an external stylesheet for all styles. All page content should be in a div with an id set to 'container', 650px wide and the content centered.

vi.The container div should also be centered on the screen (horizontally). The constructor text should be echoed using an <h3> tag. Please bold all labels as displayed above.
vii. Use the Button class to print the submit button on the form page addAlbum.php.

In: Computer Science

Suppose you are choosing between the following two algorithms: Algorithm A: solves problems of size n...

Suppose you are choosing between the following two algorithms:

Algorithm A: solves problems of size n by recursively solving two subproblems each of size (n-1) and then combining the solutions in constant time (take T(0) = 0).

Algorithm B: solves problems of size n by recursively solving one subproblem of size (n-1) and then combining the solution in (log n) time (take T(1) = 0).

  • Write down the recurrence relations for the above algorithms.                          
  • Solve the recurrence relations to find the exact number of operations for each of these two algorithms in terms of (n). Arrange the algorithms in increasing complexity.                

In: Computer Science