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 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 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 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 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 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 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
In: Computer Science
Using matlab
In: Computer Science
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 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>
</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
In: Computer Science
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 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).
In: Computer Science