Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package modul04;
- /**
- *
- * @author OBING CN
- */
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.util.Scanner;
- public class modul3 {
- public static void main(String[] args){
- File file = new File ("D:/Praktikum2.txt");
- try {
- file.createNewFile();
- PrintWriter pewe = new PrintWriter(file);
- } catch(Exception e){
- System.out.println("Gagal membuat file "+file.getPath());
- }
- Scanner input = new Scanner(System.in);
- System.out.print("Masukkan Jumlah Transaksi : ");
- int n = input.nextInt();
- String Deskripsi ;
- int Harga ;
- for(int i=0;i<=n;i++){
- System.out.print("Deskripsi: ");
- Deskripsi = input.nextLine();
- input.nextLine();
- System.out.println("Harga");
- Harga = input.nextInt();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement