nah langsung saja contoh soal kasus
1. Buatlah program yang meminta inputan jari - jari, yang kemudian dihitung dan ditampilkan luas dan keliling lingkaran tersebut. (mis. input jari - jari =5.5)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
/**
*
* @author PC 1
*/
import java.util.Scanner;
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner masukan= new Scanner (System.in);
float phi,luas,keliling,d;
float jarijari;
phi=3.14F;
d=7F;
System.out.println(" PROGRAM PENCARIAN LUAS DAN KELILING");
System.out.println("=====================================");
System.out.print("masukan Jari - Jari =");
jarijari = masukan.nextFloat();
luas=phi*jarijari*jarijari;
keliling=phi*d;
System.out.println("Luas ="+luas );
System.out.println("keliling ="+keliling);
}
}
1. Buatlah program yang meminta inputan jari - jari, yang kemudian dihitung dan ditampilkan luas dan keliling lingkaran tersebut. (mis. input jari - jari =5.5)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
/**
*
* @author PC 1
*/
import java.util.Scanner;
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner masukan= new Scanner (System.in);
float phi,luas,keliling,d;
float jarijari;
phi=3.14F;
d=7F;
System.out.println(" PROGRAM PENCARIAN LUAS DAN KELILING");
System.out.println("=====================================");
System.out.print("masukan Jari - Jari =");
jarijari = masukan.nextFloat();
luas=phi*jarijari*jarijari;
keliling=phi*d;
System.out.println("Luas ="+luas );
System.out.println("keliling ="+keliling);
}
}
yang di tulis warna merahnya saja ok dan cobalah
0 comments:
Post a Comment