Flowcharting (Iteration Structure)
Write an algorithm and draw a flowchart that will convert a given decimal number (N10) to its equivalent binary number (N2).
Flowcharting (Selection Structure)
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.
Given is GROSS_PAY, draw a 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 a program plan, an algorithm, and draw a flowchart that uses sequence structure, that would accept two (2) numbers represented by X and Y. Print the two number after interchanging their values.
1. The straight-line method for computing the yearly depreciation in value D for an item is given by the formula
D = P – S
Y
Perform the following using the given Array below.
Given : int[] arr = new int[6] { 5, 8, 9, 25, 0, 7 };
1. (arr[4] + arr[0)]] * arr[2]
Perform the following using the given Array below.
Given : int[] arr = new int[6] { 5, 8, 9, 25, 0, 7 };
Solve the recurrence using change of variable method: T(n) = 2T(n/2)+nlogn
Find out the step count for the following function using tabular method.
void ABC( int n ){
for( int i=1; i<= n; i++){
for (int j=1; j<=2^n;j=j*2) {
printf(“%d”,j);
}
}
}
void Example2 (int n){
int a = 0;
for (int i = 0; i < N; i++) {
for (int j = N; j > i; j--) {
a = a + i + j;
}
}
}
Prove weather following statements are true or false.