Hallo,
Voor mijn studie moet ik een java practicum doen wat er op neer komt dat ik een simpel programma moet bouwen voor een bibliotheek. Helaas loop ik door mijn beperkte skills al bij de (voor mijn gevoel) kleinste dingen volledig vast.Dit is de opdracht:
https://blackboard.tudelf...0%20Java%20herkansing.pdf
en dit is het geklungel wat ik geprobeerd heb tot dusver:
package Library;
import static java.lang.System.out;
public class Book {
String title;
boolean borrowed;
// Creates a new Book
public Book(String bookTitle) {
// input your own method
book = bookTitle;
return bookTitle;
}
// Marks the book as rented
public void borrowed() {
// input your own method
if (borrowed = true) { out.println("The book has been borrowed."); } };
// Marks the book as not rented
public void returned() {
// input your own method
if (borrowed = false) { out.println("The book is available."); } };
// Returns true if the book is rented, false otherwise
public boolean isBorrowed() {
// input your own method
if (borrowed = true) { isBorrowed = true; } };
// Returns the title of the book
public String getTitle() {
// input your own method
return bookTitle;
}
public static void main(String[] arguments) {
// Small test of the Book class
Book example = new Book("The Da Vinci Code");
System.out.println("Title: " + example.getTitle());
System.out.println("Borrowed?: " + example.isBorrowed()); //false
System.out.println("Borrowed?: " + example.isBorrowed()); //true
}
}
Kan iemand me helpen?
Voor mijn studie moet ik een java practicum doen wat er op neer komt dat ik een simpel programma moet bouwen voor een bibliotheek. Helaas loop ik door mijn beperkte skills al bij de (voor mijn gevoel) kleinste dingen volledig vast.Dit is de opdracht:
https://blackboard.tudelf...0%20Java%20herkansing.pdf
en dit is het geklungel wat ik geprobeerd heb tot dusver:
package Library;
import static java.lang.System.out;
public class Book {
String title;
boolean borrowed;
// Creates a new Book
public Book(String bookTitle) {
// input your own method
book = bookTitle;
return bookTitle;
}
// Marks the book as rented
public void borrowed() {
// input your own method
if (borrowed = true) { out.println("The book has been borrowed."); } };
// Marks the book as not rented
public void returned() {
// input your own method
if (borrowed = false) { out.println("The book is available."); } };
// Returns true if the book is rented, false otherwise
public boolean isBorrowed() {
// input your own method
if (borrowed = true) { isBorrowed = true; } };
// Returns the title of the book
public String getTitle() {
// input your own method
return bookTitle;
}
public static void main(String[] arguments) {
// Small test of the Book class
Book example = new Book("The Da Vinci Code");
System.out.println("Title: " + example.getTitle());
System.out.println("Borrowed?: " + example.isBorrowed()); //false
System.out.println("Borrowed?: " + example.isBorrowed()); //true
}
}
Kan iemand me helpen?