Lunes, Nobyembre 26, 2018

Methods - Activities 1-3


1.       Input two numbers.  Get the sum, difference, product, and quotient of these numbers.  Display the results afterwards.

Methods:            main – input
                                sum
                                difference
                                product
                                quotient
                                output

2.       Given:  At = 1/2bh
                Ac = πr2  (π=3.1416)
                Ar = lw
                As = s2

Input two numbers, n1 and n2.
Let:        n1 = b, r, l, s
                n2 = h, w

Methods:            main – input
                                triangle
                                circle
                                rectangle
                                square
                                output

Example: input => n1=5, n2=3
                output => Area of Triangle is 7.5
                                 Area of Circle is 78.54
                                 Area of Rectangle is 15
                                 Area of Square is 25



3.       Input:    Employee Name
                Rate Per Day
                Number of Days Worked

Where: Gross Pay = Rate Per Day * Number of Days Worked
                SSS = 10% of Gross Pay
                Tax = 15% of Gross Pay
                Total Deduction = SSS + Tax
                Net Pay = Gross Pay – Total Deduction

Methods:            main – input
                                gross pay
                                sss
                                tax
                                total deduction
                                net pay
                                output

            Example: input => Name = Ana
                                            Rate Per Day = 500
                                            Number of Days Worked = 10
                            output => Gross Pay is 5000
                                               SSS is 500
                                            Tax is 750
                                            Total Deduction is 1250
                                            Net Pay is 3750
                                 


Walang komento:

Mag-post ng isang Komento

Activity #17 - One-Dimensional Array

Place all codes under the method main. 1. Input 5 numbers and satisfy the ff:     a) sum of all input numbers     b) count of odd and ev...