For this, you should create classes:
➢ Item (available (boolean), date of loan, date of return, name and
code). Use the Calendar class to manage dates.
➢ Book (author and loan period - 14 days and should be static attribute)
➢ CD (number of tracks and loan period - 5 days)
➢ DVD (duration and loan period - 3 days)
➢ Client (name, CPF and telephone)
➢ Loan (customer and item)
➢ Vector (Interface - insert, remove and search)
➢ Customer Vector
➢ Lease Vector
➢ Item Vector
I came here. Can anyone help me?
public class Emprestimo {
static StringBuffer memoria = new StringBuffer();
static String arquivo = "Emprestimo.txt";
static void iniciarArquivo() {
String linha;
try {
BufferedReader arqEntrada;
arqEntrada = new BufferedReader(new FileReader("Emprestimo.txt"));
memoria.delete(0, memoria.length());
while ((linha = arqEntrada.readLine()) != null) {
memoria.append(linha + "\n");
}
arqEntrada.close();
} catch (FileNotFoundException erro1) {
JOptionPane.showMessageDialog(null, "Arquivo não encontrado.");
} catch (Exception erro2) {
JOptionPane.showMessageDialog(null, "Erro de leitura!");
}
}
public static void gravarDados() {
try {
String arquivo = "Emprestimo.txt";
BufferedWriter saida;
saida = new BufferedWriter(new FileWriter(arquivo, false));
saida.write(memoria.toString());
saida.flush();
saida.close();
} catch (Exception erro3) {
JOptionPane.showMessageDialog(null, "Erro de gravação");
}
}
public static void Locar (){
}
public static void Devolver (){
}
}