Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

public class Book {

String title;
String author;
String isbn;
int pageCount;
double price;

public Book(String title, String author, String isbn, int pageCount, double
price) {0
this.title = title;
this.author = author;
this.isbn = isbn;
this.pageCount = pageCount;
this.price = price;
}

public String getTitle(){


return title;
}
public void setTitle(String title){
this.title = title;
}

public String getAuthor() {


return author;
}

public void setAuthor(String author) {


this.author = author;
}

public String getIsbn() {


return isbn;
}

public void setIsbn(String isbn) {


this.isbn = isbn;
}

public int getPageCount() {


return pageCount;
}

public void setPageCount(int pageCount) {


this.pageCount = pageCount;
}

public double getPrice() {


return price;
}

public void setPrice(double price) {


this.price = price;
}
public class Person {
String firstName;
String lastName;
int age;
String gender;
String number;

public Person(String firstName, String lastName, int age, String gender, String
number) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
this.number = number;
}

public String getFirstName() {


return firstName;
}

public void setFirstName(String firstName) {


this.firstName = firstName;
}

public String getLastName() {


return lastName;
}

public void setLastName(String lastName) {


this.lastName = lastName;
}

public int getAge() {


return age;
}

public void setAge(int age) {


this.age = age;
}

public String getGender() {


return gender;
}

public void setGender(String gender) {


this.gender = gender;
}

public String getNumber() {


return number;
}

public void setNumber(String number) {


this.number = number;
}
}
public class Main {
public static void main(String[] args) {
Book book1 = new Book("Skyface", "Justin", "109376478", 500, 98);
System.out.println(book1.getTitle());
Person person1 = new Person("Richard", "Addo", 45, "male", "0547711946");
System.out.println(person1.getFirstName());
}

You might also like