Q1. You will be required to ensure that your program meets the following requirements:
i. Existence of an array which can accept an unknown number of positive integers
ii. Existence of a function which can perform a different sort where the Even numbers will appear
first before the Odd numbers. In this sorted sequence, all the even numbers will appear first
in descending order followed by the odd numbers (in the same order). You are only allowed
to use one array to perform this and NOT allowed to create another temporary array. You may
however expand or reduce the size of your dynamic array in any way you wish to perform this
sort operation.
iii. Perform Best and Worst case analysis of your algorithm. With Complete steps of maths.
a point as an object with an x and y as key attributes, another properties is to check if the point is the origin or not. use methods such as getters, setters and constructors, your class should have the following functionality listed
isOrigin() : returns true if the values of x = 0 and y =0
distanceTo() : Takes in another point and finds the distance between the two points.
distanceToX(): Calculates the distance to the x-axis
Provide a toString() : to represent all the point attributes and the value returned by the isOrigin method 1.Provide a simple Class and object diagram for the above scenario 2.Implement class modelled above and test its functionality as specified below
Sample Run1
Enter the x&y values separated by a space: 9 4
Enter the x&y values separated by a space: 3 5
Output1:
Point A(9,4) not the Origin
Point B(3, 5) not the Origin
Distance from Point A(9,4) to Point B(3,5) = 6.08
Distance of Point B (3,5) to the X-axis = 5
Point A represented with toString : x = 9, y = 4
isOrigin : False
fraction as an object with a numerator and denominator as key attributes, check if the fraction is positive or negative. Use instance methods such as getters, setters and constructors, your class should have functionality listed below:
A) isImproper() : returns true if the numerator is bigger than the denominator e.g 5/4
B) toMixed() : converts an improper fraction to mixed e.g. 9/4 = 4 1⁄2 C) AddFraction(): takes in another fraction and add them up as follows, a/b + c/d = (a x b) + (b x c) /bxd
D) Provide a toString() : to represent the fraction as X/Y or X/Y/Z for improper fractions 1.1. Provide a simple Class and object diagram for the above scenario
1.2. Implement class modelled above and test its functionality as specified below
Sample Run1
Enter the numerator and denominator separated by a space: 9 4
Enter the numerator and denominator separated by a space: 3 5
Output1:
9/4 is an Improper Fraction
3/5 is a Proper Fraction
9/4 PLUS 3/5 = 57/20
The addition result represented with toString : 2/17/20
Create a program with two methods, one method for displaying your full name and the
other method displays your address.
I am Carla May Laput and my address is 067, Purok Bougainvilla, Larayan Dapitan City 7101
Create a program that contains two methods, one for displaying all even numbers from 1
to 10 and the other one displays all odd numbers from 1-10.
Given following IP address 181.17.1.0/23; find subnet ID, network address, broadcast address and host address range?
Armstrong number between two intervals
1.Briefly explain how information systems is transforming business and why are they so essential for running and managing a business today?
2. Why is it difficult for firms to sustain a competitive advantage?
3. Describe the role of IT governance within the firm.
4. There is growing trend of BYOD (“Bring your own devices”), explain why companies opt to use this approach for their information systems and employees
5. Distributors for a furniture manufacturer are complaining that the billing for goods they order is frequently not correct, and sometimes are sent to the wrong email and postal addresses. What measures would you take to improve the quality of data in the manufacturer's databases?
1. Determine the exact output that is produced when the following code is executed. (7)
for x = 1 to 10 step 1
for y = 1 to x step 1
if y MOD 2 = 0 AND x MOD 2 <> 0 || y MOD 2 <> 0 AND x MOD 2 = 0 then
display "*"
else
display "#"
endif
next y
display " " ~newline
next x
2. Rewrite the following for-loop as a pre-test while-loop. (6)
for x = 1 to 10
for y = 10 to x
if y MOD 2 = 0 then
display "*"
else
display "#"
endif
display " " ~newline
3. Rewrite the following for-loop as a post-test do-loop. (5)
for x = 20 to -20 step -3
display "x = ", x
next x
4. Identify an error in the following pseudocode: (2)
sum = 0
for x = 1 to 10
if y MOD 2 = 0
display y
sum = sum + y