Consider the following relation with set of functional dependencies
R(ABCDEF)
AB->CD, CD->EF, BC->DEF, D->B, CE->F
a) Identify the candidate keys in the above relation (with proper steps followed).
b) Identify which normal form this relation is in and reason for the answer.
Implement a Stack to store a character in the node. Implement the following operations
push, pop and peek:.
void push (char c);
char pop();
char peek();
int isEmpty();
void printStack();
Implement a Stack to store a character in the node. Implement the following operations
push, pop and peek:.
void push (char c);
char pop();
char peek();
int isEmpty();
void printStack();
Complete class implementation
Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40 digits each. Hint: int num[40] is not smart since each element in this array is of integer type and the maximum integer that can be stored is 10 digit long.
Provide member functions
Input
Output
convert to integer
Overload arithmetic operators to
+ Add
- substract
* multiply
/ divide
Overloaded relational operators function that simply returns True if the relationship holds between the two HugeIntegers and returns false if the relationship does not hold.
==
!=
>
<
>=
<=
^ (checks if huge integer is zero)
Instruction: Create a program plan, algorithm, flowchart and pseudocode for the following cases:
A Department Store classifies its credit card holders as to local, national and international. A local card holder resides in Metro Manila, a national, anywhere in the Philippines and an international, anywhere in the world. The programmer must store a code 01, 02, and 03 for local, national and international card holders respectively. The program is to read the cards and store the proper code in each card.
Create Program Plan, Algorithm, and Flowchart. An electric company bases its charges on two rates, customers are charged P 25.00 per kilowatt-hour for the first 300 kilowatt-hours used in a month and P 30.00 each for all kilowatt-hours used thereafter. Compute for the amount due from a customer after reading the kilowatt-hours used. Assume that there are 100 records of customers.
Write an Program Plan, Algorithm and draw a flowchart that will convert a given decimal number (N10) to its equivalent Binary number (N2).
Given is GROSS_PAY, draw a program plan, algorithm, and flowchart that will compute for DEDUCTIONS and NET_PAY for employee’s weekly Payroll. Consider the conditions:
If Civil Status = ‘SINGLE’
DEDUCTIONS = GROSS_PAY * 0.03
If Civil Status = ‘MARRIED’
DEDUCTIONS = GROSS_PAY * 0.06
If Civil Status = ‘WIDOW’
DEDUCTIONS = GROSS_PAY * 0.05
If Civil Status = HEAD OF THE FAMILY’
DEDUCTIONS = GROSS_PAY * 0.02
Using the formula:
[NET_PAY = GROSS_PAY – DEDUCTIONS]
Create Program Plan, Algorithm, and Flowchart
A company classifies its products by weights as follows:
Class A – 12 pound or over
Class B – 5 to 11.9 pounds
Class C – less than 5 pounds
Show the logic of determining into which class to place an item.
First Prime Number
You are given N inputs. Write a program to print the first prime number in the given inputs.
Input
The first line of input is an integer N. The next N lines each contain an integer. Explanation
In the given example of
5 integers
1
10
4
3
2
The output should be
3.
Sample Input 1
5
1
10
4
3
2
Sample Output 1
3
Sample Input 2
4
2
3
5
7
Sample Output 2
2