Personal Blog : My OUM(Open University Malaysia) journey starting from Jan 2011 till graduate.
Everyone can copy the contents in this blog and please leave some credit or a backlink to me... -Thank You-

Saturday, February 11, 2012

CBOP 3203 OBJECT ORIENTED PROGRAMMING

Assignment for CBOP 3203 OBJECT ORIENTED PROGRAMMING

QUESTION 1

Write a program that contains y array and the z array. Both arrays have the same size. Assign {6,1,5,9,5} to y and {2,13,6,15,2} to z. The program also has a method called sumLargeNumber( ) which has the following header:

int sumLargeNumber(int a[],int b[], int size)

The method will compare the values in both arrays and sum up all the elements that are the larger value at each index position. This sum will be the returned value of the method. For example:

int[] y = {6,1,5,9,5}

int[] z = {2,13,6,15,2}

The sumLargeNumber(y, z, 5) will return 45 (6+13+6+15+5).

Write the complete and practical program for the above problem.

(20 marks)

QUESTION 2

Implement a class named threeDPoint that models a location in (x,y,z) coordinate space. The class contains:

A double data field named X that specifies x coordinate in a three dimensional Cartesian coordinate system

A double data field named Y that specifies y coordinate in a three dimensional Cartesian coordinate system

A double data field named Z that specifies z coordinate in a three dimensional Cartesian coordinate system

A no-arg constructor that creates a default point 0.0 for all the data fields

A constructor that creates an instance with the specified x-, y-, and z-coordinates.

The accessor (get) and mutator (set) methods for all three data fields.

A method named toString () that returns a string description for the point.

Then, create an object of the above class in a new program that has the main() method. All the inputs for the object must be captured in the main() method interactively.

(40 marks

Wednesday, February 1, 2012

CBWP 2203 WEB PROGRAMMING

Assignment for CBWP 2203 WEB PROGRAMMING

As an OUM student, you have been assigned to create an online questionnaire for research entitled Job Stress and Burnout among Employees in Malaysia. All respondents to the questionnaire will need to fill in their particulars and questionnaire online. You are given the paper-based version of the questionnaire, as shown in Figure 1. Your task is to transform the paper-based version into an appropriate online version.

You are also requested to do a simple score calculation on Part B of the questionnaire using JavaScript.

For question 1, 2, 3, 4, 6, 8 and 9, the mark for 0 is 0, 1 is 1, 2 is 2, 3 is 3, 4 is 4, 5 is 5 and 6 is 6.

For question 5, 7 and 10, the mark for 0 is 6, 1 is 5, 2 is 4, 3 is 3, 4 is 2, 5 is 1 and 6 is 0.

The example calculation is as follows:

Example 1:

If all responses for question 1, 2, 3, 4, 6, 8 and 9 are 6s, and all responses for question 5, 7 and 10 are 0s then the overall rating is equal to

((6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6) / 60) x 100% = 100%

Once the form is submitted, you should display pop out message {Your stress level is 100%}.

Example 2:

If the response for question 1 is 2, 2 is 4, 3 is 6, 4 is 1, 5 is 2, 6 is 5, 7 is 2, 8 is 4, 9 is 6 and 10 is 4 then the overall rating is equal to

((2 + 4 + 6 + 1 + 4 + 5 + 4 + 4 + 6 + 2) / 60) x 100% = 63.3%

Once the form is submitted, you should display pop out message {Your stress level is 63%}.

Please prompt an error message if any field is left blank by the user.

Table Grade