Jumat, 12 Oktober 2012
package javalatian;
import java.io.*;
import java.util.Scanner;
/**
*
* @author 7
*/
public class Javalatian {
private int noSeri;
private String warna;
private String nama;
private String status;
private int maxspeed;
private int speed= 0;
public void mobil (int noSeri, String warna, String nama, int maxspeed){
this.setNoSeri(noSeri);
this.setWarna(warna);
this.setNama(nama);
this.setMaxspeed(maxspeed);
}
public void setnoSeri(int noSeri){
this.setNoSeri(noSeri);
}
public int getnoSeri(){
return getNoSeri();
}
public void Start(){
status = "hidup";
// if(Status.equal("Hidup"));
}
public void percepat(int x){
if(status.equals("hidup")){
if (getSpeed()+x>getMaxspeed()){
System.out.println("Kecepatan maksimum");
}
else {
setSpeed(getSpeed()+x);
}
System.out.println("Hidupkan mesin");
}
}
public void perlambat(int x){
if(status.equals("hidup")){
if(getSpeed()-x<=0){
System.out.println("Kecepatan maksimum");
}else{
setSpeed(getSpeed()-x);
}
}
System.out.println("Idupin Mobil");
}
public static void berhenti(int speed,String status){
System.out.println("Berhenti");
speed = 0;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
/**
* @return the noSeri
*/
public int getNoSeri() {
return noSeri;
}
/**
* @param noSeri the noSeri to set
*/
public void setNoSeri(int noSeri) {
this.noSeri = noSeri;
}
/**
* @return the warna
*/
public String getWarna() {
return warna;
}
/**
* @param warna the warna to set
*/
public void setWarna(String warna) {
this.warna = warna;
}
/**
* @return the nama
*/
public String getNama() {
return nama;
}
/**
* @param nama the nama to set
*/
public void setNama(String nama) {
this.nama = nama;
}
/**
* @return the maxspeed
*/
public int getMaxspeed() {
return maxspeed;
}
/**
* @param maxspeed the maxspeed to set
*/
public void setMaxspeed(int maxspeed) {
this.maxspeed = maxspeed;
}
/**
* @return the speed
*/
public int getSpeed() {
return speed;
}
/**
* @param speed the speed to set
*/
public void setSpeed(int speed) {
this.speed = speed;
}
}
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar