Introduction to Database SHort answer question
-1)Can intersection data be placed in the entity box of one of the two entities in the many-to-many binary relationship? If yes, describe which one. If not, where can you put it? Explain.
-2)What is the difference between a record type and an occurrence of that record? Explain and give example(s).
-3)Name at least 4 entities, some sample attributes for each entity, and the primary key field for each entity, in a university environment .
4)How foreign key is used to set-up one-to-many relationships in relational databases? Explain and give example (example from the lecture is ok).
5) How to implement Many-to-Many relationship in a relational Database? Explain and give example (example from the lecture is ok)
6)Describe referential integrity problem in general. In the specific case of deleting a record in a table on the “one side” of a one-to-many relationship, how would referential integrity occur?
In: Computer Science
Which of the following statements is false?
| a. |
UML represents instance variables as an attribute name, followed by a colon and the type |
|
| b. |
Private attributes are preceded by the keyword private in the UML |
|
| c. |
In the UML, each class is modeled in a class diagram as a rectangle with three compartments. The top one contains the class’s name centered horizontally in boldface. The middle one contains the class’s attributes, which correspond to instance variables in Java. The bottom one contains the class’s operations, which correspond to methods and constructors in Java |
|
| d. |
The UML models operations by listing the operation name followed by a set of parentheses. A plus sign (+) in front of the operation name indicates that the operation is a public |
In: Computer Science
. Create a Python function that asks the user for a number (integer). The function should then tell the user how many hundreds can go into the number, and how much is left over.
Hint: the % operator calculates the remainder of a division. For example, 10 % 3 gives a result 1.
Hint2: Deal with the positive and negative values in separate parts of an if-else structure. Get the calculation work for positive values first. For negative values, make them positive (num = -num) and then use the same method as for positive values, adapting as
this is a python program so i need your help to complete this task. as i have to submit it by tomorrow.
thanks
In: Computer Science
Exercise #1:
Create an abstract class called GameTester. The GameTester class includes a name for the game tester and a boolean value representing the status (full-time, part-time).
Include an abstract method to determine the salary, with full-time game testers getting a base salary of $3000 and part-time game testers getting $20 per hour.
Create two subclasses called FullTimeGameTester, PartTimeGameTester. Create a console application that demonstrates how to create objects of both subclasses. Allow the user to choose game tester type and enter the number of hours for the part-time testers.
Exercise #2:
CityToronto bank provides mortgages for individuals and businesses up to $300,000. Write a Java application that keeps track of mortgages and computes the total amount owed at any time (mortgage amount + interest).
Design the following classes to implement your application:
Mortgage – an abstract class that implements the MortgageConstants interface. A Mortgage includes a mortgage number, customer name, amount of mortgage, interest rate, and term.
Don’t allow mortgage amounts over $300,000. Force any mortgage term that is not defined in the MortgageConstants interface to a short-term, one year loan. Create a getMortgageInfo method to display all the mortgage data.
MortgageConstants – includes constant values for short-term (one year), medium-term (three years) and long-term (5 years) mortgages. It also contains constants for bank name and the maximum mortgage amount.
BusinessMortgage – extends Mortgage. Its constructor sets the interest rate to 1% over the current prime rate.
PersonalMortgage - extends Mortgage. Its constructor sets the interest rate to 2% over the current prime rate.
ProcessMortgage – a main class that create an array of 3 mortgages. Prompt the user for the current interest rate. Then in a loop prompts the user for a mortgage type and all relevant information for that mortgage. Store the created Mortgage objects in the array. When data entry is complete, display all mortgages.
In: Computer Science
Draw a single graph in Python showing the performance of both a linear and binary search algorithm against the number of elements (100,000). Consider the worst case scenario. In the graph we want to see: labeling of the axes, a legend, a title and the graphs for both linear and binary search, again correctly labeled. Explain what you see. Hint: Use Plot Functions (Plot Chart, series from functions) from the H!de Editor.
In: Computer Science
This assignment is one program demonstrating IF statements and Decisions in C++ format.
Program 2 People eating at a restaurant get to eat for free if they are younger than 10, pay full price if they are under 65, get a $3 discount if they are 65 or over. Write a program asking the user for an age of the next customer and the price of the food they ordered. Calculate how much to charge based on the price (set to 0, full price, or with a discount) along with a 15% tip. Then have the program show this amount to the user. Examples: What age is the person 5 What price is the meal 10 The charge for this person is 0 (a second program run) What age is the person 70 What price is the meal 10 The charge for this person is 8.05
In: Computer Science
(1) T(n)=9⋅T(n3)+n2⋅(log(n))2
(2) T(n) = 10 * T(n/3) + n^2
One of these can be solved using the Master Theorem; the other cannot.
In: Computer Science
In: Computer Science
Thanks in advance.
In Java.
I'm having an issue with one of my methods.
Ex:
The array being pass in is a character array with element: w, ' ', K, Q, k, q, ' ', -, ' ', 0, ' ', 1
public class Find
{
public void enPassant(char[] array)
{
for(int i = 0; i < array.length; ++i)
{
if(array[i] == 'e')
{
count = i;
}
else
{
count += 0;
}
}
if(count > 0)
{
System.out.println("En passant: " + array[count] + array[count +
1]);
}
if(count == 0)
{
System.out.println("En passant: none");
}
}
public class Main
{
public static void main(String[] args)
{
Find testDetail = new Find();
testDetail.enPassant(detailArray);
}
}
Output: Enpassant: kq
My intended output is: Enpassant: none
Why am i getting kq, and what can i do to correct my mistake?
In: Computer Science
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
In: Computer Science
JAVA CODE_
Use menu based functionality and validation loops to create a new customer bonus fruit package application for the Dirt to Dish discount produce company.
The program you create will prompt the user to enter a number to select one of three bonus pack options:
1 for Apple pack
2 for Orange pack
3 for Banana pack
**Use input validation to ensure a valid option has been
selected before proceeding.
Use variables to keep track of how many of each fruit a customer will have depending on which bonus pack has been chosen. The amount of fruit per bonus pack is given as follows:
Banana pack: 5 bananas, 2 apples, 2 oranges
Orange pack: 5 oranges, 2 apples, 2 bananas
Apple pack: 5 apples, 2 bananas, 2 oranges
Use menu based functionality and input validation and prompt the user to choose from one of the following recipes:
1. Fruit medley (2 of each fruit)
2. Mixed Apple Pie (3 apples, 1 orange, 1 banana)
3. Banana tower (4 bananas, 2 oranges)
The amount of fruit required for each recipe is shown in
parenthesis.
After a valid recipe choice has been made, subtract the amount of fruit needed for the recipe if the customer has enough fruit. If the customer does not have enough fruit then show a message telling the customer to buy more fruits.
Finally display the amount of fruit remaining from the bonus pack after the recipe selection has been made.
First example run:
This is Dirt to Dish's new customer bonus service! Please select your free fruit package: 1. Apple pack 2. Orange pack 3. Banana pack Please enter 1, 2, or 3: 2 You have chosen: Orange pack You have a total of: 2 apples 5 oranges 2 bananas Which dish would you like to make first? 1. Fruit medley (2 of each fruit) 2. Mixed Apple Pie (3apples, 1 orange, 1 banana 3. Banana tower (4 bananas, 2 oranges Please enter 1, 2, or 3: 2 Mixed Apple Pie chosen Sorry, you need more fruits! The fruit you have left is: 2 apples 5 oranges 2 bananas Thank you!
In: Computer Science
Create a 32-bit Linux-based assembler language program (nasm) which:
1. Defines these variables:
A: A single byte
B: A word
C: A double word
D: A double word
2. Using the eax register (and its sub-registers), process the following equations (ONLY using the mov, add and sub assembly keywords):
I. A + (B + C) = D
II. (A + C) - B = D
3. Using the linux function library, print a string describing each equation, then values in each variable, and then the answer in the resulting variable
4.Use the following values in your equation:
I. 10h
II. 2000h
III. 30000
Sample Output: The Result of A + (B + C) = D is: 32010
When printing out a string in NASM, use the linux function library call PrintString. Make sure your string is 00h terminated. • When printing out a Hexadecimal value in NASM, use the linux function library call Print32bitNumHex
In: Computer Science
c++
do add comments for better understanding
Lapindrome is defined as a string which when split in the
middle, gives two halves having the same characters and same
frequency of each character. If there are odd number of characters
in the string, we ignore the middle character and check for
lapindrome. For example gaga is a lapindrome, since the two halves
ga and ga have the same characters with same frequency. Also,
abccab, rotor and xyzxy are a few examples of lapindromes. Note
that abbaab is NOT a lapindrome. The two halves contain the same
characters but their frequencies do not match.
Your task is simple, declare a C++ Class Lapindrome that has a
function checkLapindrome which display Yes if the string is
Lapindrome otherwise, it should display No. The structure of the
Class is given below. You are required to implement every function
given in the class Lapindrome.
class Lapindrome
{
private:
int size; char* cstr;
public:
Lapindrome (int size=10); //initialize size and cstr
void setStr(char* cstr); //Assign the value of cstr to member
variable cstr
char* getStr();
//returns the string cstr. void checkLapindrome (); //Display Yes
if the cstr is Lapindrome otherwise No ~Lapindrome();
//Destructor
};
In: Computer Science
Would you consider a career in UX? Why or why not?
How much experience/knowledge do you have in user interface design, prototyping and usability?
In: Computer Science
Consider the following program that creates an ArrayList of objects of a type A, and sorst them. Supply the missing code. Sample output when you run the program is shown below.
import java.util.*;
class A
{ int i, j, k;
public A(int i, int j, int k){
this.i=i;
this.j=j;
this.k=k;
}
public String toString(){
return "A("+i+","+j+","+k+")";
}
}
class SortA {
public static void main(String[] args){
ArrayList aL=new ArrayList();
Random rand= new Random(1000); //1000 is a seed value
for (int p=0; p<10; p++){
int i = rand.nextInt(100);
int j = rand.nextInt(200);
int k = rand.nextInt(300);
aL.add(new A(i, j, k));
}
System.out.println("----- Original arraylist------");
for (A a: aL){
System.out.println(a);
}
System.out.println("----- Sorting by first integer-------");
/*YOUR CODE - Use anonymous interface types to sort by first integer Field in A, and then print the resulting ArrayList */
System.out.println("----- Sorting by second integer-------");
/*YOUR CODE - Use anonymous interface types to sort by the second integer Field in A, and then print the resulting ArrayList */
System.out.println("----- Sorting by third integer-------"); /*YOUR CODE - Use anonymous interface types to sort by the third integer Field in A, and then print the resulting ArrayList */
} }
Output
----- Original list -------
A(87,135,276)
A(24,192,149)
A(41,45,164)
A(50,179,259)
A(72,183,36)
A(75,46,202)
A(23,41,222)
A(71,189,202)
A(93,142,49)
A(42,35,176)
----- Sorting by first integer-------
A(23,41,222)
A(24,192,149)
A(41,45,164)
A(42,35,176)
A(50,179,259)
A(71,189,202)
A(72,183,36)
A(75,46,202)
A(87,135,276)
A(93,142,49)
----- Sorting by second integer-------
A(42,35,176)
A(23,41,222)
A(41,45,164)
A(75,46,202)
A(87,135,276)
A(93,142,49)
A(50,179,259)
A(72,183,36)
A(71,189,202)
A(24,192,149)
----- Sorting by third integer-------
A(72,183,36)
A(93,142,49)
A(24,192,149)
A(41,45,164)
A(42,35,176)
A(75,46,202)
A(71,189,202)
A(23,41,222)
A(50,179,259)
A(87,135,276)
In: Computer Science