NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package mobilv2;
import java.util.Scanner;

public class Mobilv2 {

private String Merk;
private String Tipe;
private long Harga;
private int JumlahPenumpang;
private String BahanBakar;

public Mobilv2(String merk, String tipe, long harga, int jumlahpenumpang, String bahanbakar)
{
Merk = merk;
Tipe = tipe;
Harga = harga;
JumlahPenumpang = jumlahpenumpang;
BahanBakar = bahanbakar;
}

public Mobilv2()
{

}

public Mobilv2(String merk, String tipe)
{
Merk = merk;
Tipe = tipe;
}

public void setMerk (String merk)
{
Merk = merk;
}
public void setTipe (String tipe)
{
Tipe = tipe;
}
public void setHarga (long harga)
{
Harga = harga;
}
public void setJumlahPenumpang (int jumlahpenumpang)
{
JumlahPenumpang = jumlahpenumpang;
}
public void setBahanBakar (String bahanbakar)
{
BahanBakar = bahanbakar;
}

public String getMerk()
{
return Merk;
}
public String getTipe()
{
return Tipe;
}
public long getHarga ()
{
return Harga;
}
public int getJumlahPenumpang ()
{
return JumlahPenumpang;
}
public String getBahanBakar ()
{
return BahanBakar;
}

public void masukanDataMobil()
{
String merk;
String tipe;
long harga;
int jumlahpenumpang;
String bahanbakar;


Scanner masukan=new Scanner(System.in);

System.out.println("Masukan Data Mobil");
System.out.println("Masukan Merk: ");
merk = masukan.nextLine();
System.out.println("Masukan Tipe: ");
tipe = masukan.nextLine();
System.out.println("Masukan Harga: ");
harga = masukan.nextLong();
System.out.println("Masukan Jumlah Penumpang: ");
jumlahpenumpang = masukan.nextInt();
System.out.println("Masukan Bahan Bakar: ");
bahanbakar = masukan.next();
}

public void tampilDataMobil()
{
System.out.println("Informasi Mobil");
System.out.println("Merk= "+ Merk);
System.out.println("Tipe= "+ Tipe);
System.out.println("Harga= "+ Harga);
System.out.println("Jumlah Penumpang= "+ JumlahPenumpang);
System.out.println("Bahan Bakar= "+ BahanBakar);
}

public void tampilDataMobil2()
{
System.out.println("Informasi Mobil");
System.out.println("Merk= "+ Merk);
System.out.println("Tipe= "+ Tipe);
}

/**
* @param args the command line arguments
*/
boolean cek(long harga, String bahanbakar)
{
if(harga>=Harga && bahanbakar.equals(BahanBakar))
return true;
else
return false;
}

public static void main(String[] args) {
// TODO code application logic here
String merk;
String tipe;
long harga;
int jumlahpenumpang;
String bahanbakar;

Mobilv2 mobil1, mobil2,mobil3;

Scanner masukan=new Scanner(System.in);

/*System.out.println("Masukan Data Mobil");
System.out.println("Masukan Merk: ");
merk = masukan.nextLine();
System.out.println("Masukan Tipe: ");
tipe = masukan.nextLine();
System.out.println("Masukan Harga: ");
harga = masukan.nextLong();
System.out.println("Masukan Jumlah Penumpang: ");
jumlahpenumpang = masukan.nextInt();
System.out.println("Masukan Bahan Bakar: ");
bahanbakar = masukan.next();

mobil1 = new Mobilv2(merk,tipe,harga,jumlahpenumpang,bahanbakar);

mobil1.tampilDataMobil();

System.out.println("Masukan Data Mobil");
System.out.println("Masukan Merk: ");
merk = masukan.nextLine();
System.out.println("Masukan Tipe: ");
tipe = masukan.next();

mobil2 = new Mobilv2(merk,tipe);
*/
mobil3 = new Mobilv2();
mobil3.masukanDataMobil();
mobil3.tampilDataMobil();

System.out.println("Masukan data yang ingin di cek");
System.out.println("Masukan Harga: ");
harga = masukan.nextLong();
System.out.println("Masukan Tipe: ");
bahanbakar = masukan.next();
if(mobil3.cek(harga, bahanbakar)== true)
System.out.println("Sesuai yang dicari");
else
System.out.println("tidak sesuai yang dicari");
//mobil2.tampilDataMobil2();

}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.