Tugas 3 - Abstraksi dan Modularisasi PBO
Untuk pertemuan ketiga kali ini, kami diberi tugas untuk membuat abstraksi dan modularisasi dari jam digital waktu sholat seperti yang ada pada masjid.
Abstraksi
Berikut merupakan abstraksi dari jam digital waktu sholat,
Modularisasi
Setelah membuat abstraksi dari jam digital, dapat diambil kesimpulan, terdapat beberapa class yang akan dibuat dalam modularisasi, yakni class Shubuh, Dhuhur, Ashar, Maghrib, Isya, dan juga Realtime
Berikut merupakan dokumentasi dari modularisasi dari jam digital,
Source Code & Output
Berikut merupakan source code program,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Fidhia Ainun Khofifah | |
* @version 21/10/2020 | |
*/ | |
import java.time.format.DateTimeFormatter; | |
import java.time.LocalDateTime; | |
public class Realtime extends SholatTime | |
{ | |
public static void main(String[] args) | |
{ | |
LocalDateTime now = LocalDateTime.now(); | |
System.out.println("Waktu Sekarang :"); | |
DateTimeFormatter apf = DateTimeFormatter.ofPattern("HH:mm:ss"); | |
System.out.println(apf.format(now)); | |
SholatTime Time = new SholatTime(); | |
System.out.println("Shubuh :"+ Time.getShubuh()); | |
System.out.println("Dhuhur :"+ Time.getDhuhur()); | |
System.out.println("Ashar :"+ Time.getAshar()); | |
System.out.println("Maghrib :"+ Time.getMaghrib()); | |
System.out.println("Isya :"+ Time.getIsya()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Fidhia Ainun Khofifah | |
* @version 21/10/2020 | |
*/ | |
public class SholatTime | |
{ | |
private String Shubuh, Dhuhur, Ashar, Maghrib, Isya; | |
SholatTime() | |
{ | |
this.Shubuh = "03:45:00"; | |
this.Dhuhur = "11:04:00"; | |
this.Ashar = "14:23:00"; | |
this.Maghrib = "17:23:00"; | |
this.Isya = "18:33:00"; | |
} | |
String getShubuh() | |
{ | |
return Shubuh; | |
} | |
String getDhuhur() | |
{ | |
return Dhuhur; | |
} | |
String getAshar() | |
{ | |
return Ashar; | |
} | |
String getMaghrib() | |
{ | |
return Maghrib; | |
} | |
String getIsya() | |
{ | |
return Isya; | |
} | |
} |
Berikut merupakan hasil run code program,
Comments
Post a Comment