Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.BufferedWriter;
- import java.io.PrintWriter;
- import java.util.Scanner;
- public class HitungIP{
- public static void main(String[] args) throws FileNotFoundException {
- //tambahkan variabel atau object-object bila diperlukan
- try{
- // Minta nama file input.
- Scanner scan = new Scanner(System.in);
- System.out.print("Input file: ");
- String inputFileName = scan.next();
- // Buka file input.
- File inputFile = new File(inputFileName);
- // Baca baris pertama yang berisi tahun ajaran.
- Scanner sc = new Scanner(inputFile);
- int lineNumber = 1;
- // Lakukan validasi tahun ajaran
- // throw exception anda sendiri kalau terjadi error
- // while loop untuk memproses data dari file
- while (. . . ) {
- // baca baris dari file input
- // manipulasi input jika diperlukan
- // gunakan method hitungIP() untuk menghitung IP
- // simpan data sesuai kategori
- }
- // tambahkan statement yang diperlukan
- }
- catch (. . . ) {
- }
- catch (. . . ) {
- }
- catch (. . . ) {
- }
- }
- /**
- * TO DO lengkapi method berikut!
- * Method untuk menghitung nilai IP
- */
- public static double hitungIP(. . .){
- try {
- }
- catch (. . .) {
- }
- }
- /**
- * Tambahkan method anda sendiri jika diperlukan
- */
- }
- /**
- * Buat kelas exception anda sendiri jika diperlukan
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement