2/09/2015

DCT1093 OOP : Assignment 2

    Tugasan 2 adalah dalam bentuk kumpulan.
    1 kumpulan boleh terdiri daripada 4 atau 5 orang.
    Sila beri nama kumpulan pada 12/2/2015.
    Setiap kumpulan perlu menjawab 2 soalan sahaja. Satu soalan dari Section A dan satu soalan dari Section B. Penentuan soalan akan ditentukan oleh pensyarah.

SECTION A - LOOPING


1. (Conversion from kilograms to pounds) Write a program that displays the following table (note that 1 kilogram is 2.2 pounds):

Kilograms Pounds

1         2.2

3         6.6

...

197       433.4

199       437.8


   

2.(Conversion from miles to kilometers) Write a program that displays the following table (note that 1 mile is 1.609 kilometers):

Miles    Kilometers

1        1.609

2        3.218

...

9        14.481

10       16.09


   

3. (Finding the highest score) Write a program that prompts the user to enter the number of students and each student's score, and finally displays the highest score.


 
4. (Finding the highest score) Write a program that input 15 students name and score and finally displays the student with the highest score.


 
5. (Summing a series) Write a program to sum the following series:

10+20+30+40+50……100

  

6. (Counting positive and negative numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, Your program ends with the input 0.
For example, if you entered 1, 2, -7 and 0  the output should be

Positive numbers=2

Negative numbers =1
   

7.(Counting positive and negative numbers) Write a program that reads 20 number of integers, determines how many positive and negative values have been read


   

8.(Counting odd and even of positive  numbers) Write a program that reads an unspecified number of integers, determines how many odd and even values have been read. Your program ends with the input is negative (any negative number). Display the average as a floating-point number.

For example, if you entered 1, 2, 0 and -1  the output should be

Odd numbers=1

Even numbers =2

   

9.(Finding numbers divisible by 5 and 6) Write a program that displays all the numbers from 100 to 1000, ten per line, that are divisible by 5 and 6.




SECTION B – METHOD
Write method headers for the following methods:

1.    Computing a sales commission, given the sales amount and the commission rate.
2.    Computing the discount, given the price and discount amount (percentage).
3.    Printing the calendar for a month, given the month and year.
4.    Computing a square root.
5.    Computing an average of four integers.
6.    Testing whether a number is even, and returning true if it is.
7.    Printing a message a specified number of times.
8.    Computing the monthly payment, given the loan amount, number of years, and annual interest rate.

9.    Finding the corresponding uppercase letter, given a lowercase letter.

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...