MEMBUAT PROGRAM PENENTU FUNGSI KOMPOSISI DENGAN JAVA

HOLLA Netbeaners😀

Kali ini saya memposting listing program untuk membuat program yang bisa menentukan (membuat) fungsi komposisi dengan bahasa pemrograman java. Kalian hanya tinggal menginputkan element dari masing-masing fungsi dan ketika program di run Whoolaaa terbentuklah beberapa fungsi komposisi.

Cek this Out!😉

LISTING PROGRAM :

import java.io.*;
class fungsiKomposisi{
public static void main(String[] args) throws Exception{
BufferedReader Input=new BufferedReader(new InputStreamReader(System.in));
System.out.println(“Masukkan Banyak Ordinat”);
int jumlah=Integer.parseInt(Input.readLine());
int x[]=new int[jumlah];
int fungsi1[]=new int[jumlah];
int fungsi2[]=new int[jumlah];
int fog[]=new int[jumlah];
for (int i=0;i<jumlah ;i++ ){
System.out.println(“Masukkan Elemen X ke”+(i+1)+” = “);
x[i]=Integer.parseInt(Input.readLine());
}
for (int i=0;i<jumlah ;i++ ){
fungsi1[i]=x[i]*x[i]+x[i]+2;
}
for (int i=0;i<jumlah ;i++ ){
fungsi2[i]=x[i]*x[i]+x[i]-1;
}
for (int i=0;i<jumlah ;i++ ){
fog[i]=fungsi2[i]*fungsi2[i]+fungsi2[i]+2;
}
System.out.println();
System.out.println(“Fungsi f(x) = x^2+x+2”);
System.out.println(“Fungsi g(x) = x^2+x-1”);
System.out.print(“Fungsi f(x) = {“);
for (int i=0;i<jumlah ;i++ ){
System.out.print(fungsi1[i]);
if (i != jumlah-1){
System.out.print(“,”);
}
}
System.out.println(“}”);
System.out.println();
System.out.print(“Fungsi g(x) = {“);
for (int i=0;i<jumlah ;i++ ){
System.out.print(fungsi2[i]);
if (i != jumlah-1){
System.out.print(“,”);
}
}
System.out.println(“}”);
System.out.println();
System.out.print(“Fungsi fog(x) = {“);
for (int i=0;i<jumlah ;i++ ){
System.out.print(fog[i]);
if (i != jumlah-1){
System.out.print(“,”);
}
}
System.out.println(“}”);
}
}

Silahkan memcoba🙂 semoga programnya berhasil dan dapat di running dengan sempurna😀

Sekian posting kali ini, semoga dapat bermanfaat😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s