public void changeOwner(BookStoreOwner currentOwner, BookStoreOwner newOwner)
Allows the current owner of this book store to give this book store to a new owner.
Parameters: currentOwner - the current owner of this book store newOwner - the new owner of this book store
Throws: java.lang.IllegalArgumentException - if currentOwner reference is not the reference of the current owner of this book store
Any questions on top of this I am ready to explain that for you
SOLUTION:
package testing;
public class BookStoreOwner {
//i have created some sample fields of owner
private String name;
private String id;
private int age;
private String address;
//gettters and setters for that with to string
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void changeOwner(BookStoreOwner currentOwner,
BookStoreOwner newOwner) throws IllegalArgumentException{
System.out.println("current owner
"+currentOwner.toString());
//details before updating the
currentowner
currentOwner.setName(newOwner.getName());
currentOwner.setId(newOwner.getId());
currentOwner.setAge(newOwner.getAge());
currentOwner.setAddress(newOwner.getAddress());
//updated current owner details to
new owner
System.out.println("New Owner is
"+currentOwner.toString());
}
@Override
public String toString() {
return "BookStoreOwner [name=" +
name + ", id=" + id + ", age=" + age + ", address=" + address +
"]";
}
public static void main(String[] args) {
//create instance of current
ownner
BookStoreOwner currentOwner=new
BookStoreOwner();
currentOwner.setName("name");
currentOwner.setId("123");
currentOwner.setAge(20);
currentOwner.setAddress("New
jersey");
//create instance of new
ownere
BookStoreOwner newOwner=new
BookStoreOwner();
newOwner.setName("name1");
newOwner.setId("124");
newOwner.setAge(25);
newOwner.setAddress("New
York");
//call the change owner
method
BookStoreOwner test=new
BookStoreOwner();
test.changeOwner(currentOwner,
newOwner);
}
}
Code image and output:


public void changeOwner(BookStoreOwner currentOwner, BookStoreOwner newOwner) Allows the current owner of this book store to give...
Java Programming: The following is my code: public class KWSingleLinkedList<E> { public void setSize(int size) { this.size = size; } /** Reference to list head. */ private Node<E> head = null; /** The number of items in the list */ private int size = 0; /** Add an item to the front of the list. @param item The item to be added */ public void addFirst(E...
What is output? public abstract class People { protected string name; protected int age; public abstract void PrintInfo(); public void PrintInformation() { System.out.println("In Base Class People"); public class Teacher extends People { private int experience; public void PrintInfo() { System.out.println("In Child Class Teacher"); public class Principal extends Teacher { public void PrintInformation() { System.out.println("In Child Class Principal"); public static void main(String args[]) { Principal tim; tim = new Principal(); tim.PrintInfo(); In Base Class People Error: Compiler error In Child Class...
h e Splashy Fish Store allows qualified customers to purchaseems on credit. During the current year, Lisa, the owner of the store, determines that 3.500 of Splashy Fish Store's deduction for the uncollectible accounts receivable? a. Any deduction for the uncollectible accounts receivable will be treated as a short term capitals b. Splashy is not allowed a deduction for the uncollectible account the income ising from the account has not been presen ted in t he com c. Only $3,000...
How to solve this problem?
Consider the following class : public class Store Public final double SALES TAX_RATE = 0.063B private String name; public Store(String newName) setName ( newName); public String getName () { return name; public void setName (String newName) { name = newName; public String toString() return "name: “ + name; Write a class encapsulating a web store, which inherits from Store. A web store has the following additional attributes: an Internet Address and the programming language in...
create an ERD for a small book store . The owner would like to database to keep track of Books, Authors, and Publisher only (hint: do these sound like entities?). Create appropriate attributes, keys, relationships, and data types. Keep in mind that Many-to-Many relationships should not be implemented in the database. These relationships should be broken into One-to-Many relationships using Associative Entities.
Given a singly-linked list interface and linked list node class, implement the singly-linked list which has the following methods in Java: 1. Implement 3 add() methods. One will add to the front (must be O(1)), one will add to the back (must be O(1)), and one will add anywhere in the list according to given index (must be O(1) for index 0 and O(n) for all other indices). They are: void addAtIndex(int index, T data), void addToFront(T data), void addToBack(T...
Create a class named Billing that includes three overloaded computeBill() methods for a photo book store. • When computeBill() receives a single parameter, it represents the price of one photo book ordered. Add 8% tax, and return the total due. • When computeBill() receives two parameters, they represent the price of a photo book and the quantity ordered. Multiply the two values, add 8% tax, and return the total due. • When computeBill() receives three parameters, they represent the price...
Fix the following null pointer error. import java.util.*; import java.io.*; public class PhoneBook { public static void main(String[]args)throws IOException { PhoneBook obj = new PhoneBook(); PhoneContact[]phBook = new PhoneContact[20]; Scanner in = new Scanner(System.in); obj.acceptPhoneContact(phBook,in); PrintWriter pw = new PrintWriter("out.txt"); obj.displayPhoneContacts(phBook,pw); pw.close(); } public void acceptPhoneContact(PhoneContact[]phBook, Scanner k) { //void function that takes in the parameters //phBook array and the scanner so the user can input the information //declaring these variables String fname = ""; String lname = ""; String...
public void withdraw(double amount) throws InsufficientFundsException{ if (amount > this.balance) throw new InsufficientFundsException("Sorry, you have insufficient funds!"); else { this.balance = this.balance - amount; } } } can that be put in try-catch blocks? if so how does it look
Language = JAVA Create a new Java file called PhotoBillingYourLastName with a public static void main. Create three overloaded computePhotoBill() methods for Shutterfly. When computePhotoBill() receives a single double parameter, it represents the price of one photo book ordered. Add 6% tax and return the total due as a double. When computePhotoBill() received two parameters, they represent the price of a photo book and the quantity ordered (int). Multiply the two values, add 6% tax and return the total due....