5/31/2017

BCS2233 OOP. Lab 1 Jun 2017

1. Show output of the following java program.
 click here to download the file.
 
public class demomethod2 {
    
    public static void main(String[] args) {
    ucapan("Selamat Berpuasa");
    kepala();
    tangan();
    badan();
    kaki();
    ucapan("Maaf Zahir Batin");
   
    }

public static void kepala(){
        System.out.println("      *");
    System.out.println("    *   *");
    System.out.println("   * O O *");
    System.out.println("  *   |   *");
    System.out.println("   *  _  *");
    System.out.println("    *   *");
    System.out.println("      **");
}

public static void tangan(){
System.out.println("***************");
}

public static void badan(){
        System.out.println("      **");
    System.out.println("      **");
    System.out.println("      **");
    System.out.println("      **");
}
public static void kaki(){
        System.out.println("     ** **");
    System.out.println("    **   **");
    System.out.println("    **   **");
    System.out.println("    **   **");
    System.out.println("  ****   ****");
}

public static void ucapan(String msg ){
int i;
for (i=1;i<=3;i++){
System.out.println(msg);
}
}

}

 2. Write method headers for the following methods: 

a. Computing a sales commission, given the sales amount and the commission rate.

b. Printing the calendar for a month, given the month and year.

c. Computing a square root.

d. Testing whether a number is even, and returning true if it is.

e. Printing a message a specified number of times.


3. Implements a method for Question 2 a,d and e. Write a test program that invokes these methods.

4. (Conversions between feet and meters) Write a class that contains the following
 method:

/** Convert from feet to meters */
public static double footToMeter(double foot)

The formula for the conversion is:
foot = 3.279 * meter
Write a test program that invokes these methods to display the following tables:











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.  ...