Concept explainers
In blue J add a no argument constructor for the constructor of the code below:
public class Book
{
private String author;
private String title;
private int pages;
private String publisher;
//String for phone number because it is too big a number to store in int or long
private String phone;
//constructor
public Book ()
{
}
public Book(String author, String title, int pages, String publisher, String phone)
{
this.author = author;
this.title = title;
this.pages = pages;
this.publisher = publisher;
this.phone = phone;
}
//getters and setters
public String getAuthor()
{
return author;
}
public void setAuthor(String author)
{
this.author = author;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public int getPages()
{
return pages;
}
public void setPages(int pages)
{
this.pages = pages;
}
public String getPublisher()
{
return publisher;
}
public void setPublisher(String publisher)
{
this.publisher = publisher;
}
public String getPhone()
{
return phone;
}
public void setPhone(String phone)
{
this.phone = phone;
}
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- I have the following code: public class Length{ private int feet; private int inches; Length() { feet = inches = 0; } Length(int newFeet, int newInches) { feet = newFeet; inches = newInches; } public int getFeet() { return feet; } public void setFeet(int newFeet) { feet = newFeet; } public int getInches() { return inches; } public void setInches(int newInches) { inches = newInches; } public void add(Length otherLength) { int newFeet = this.feet + otherLength.feet; int newInches = this.inches + otherLength.inches; if(newInches >= 12) { newFeet++; newInches -= 12; } this.setFeet(newFeet); this.setInches(newInches); } public Length subtract(Length otherLength) { if(this.feet > otherLength.feet) { int newFeet = feet - otherLength.feet; int newInches = inches - otherLength.inches;…arrow_forwardC# Solve this error using System; namespace RahmanA3P1BasePlusCEmployee { public class BasePlusCommissionEmployee { public string FirstName { get; } public string LastName { get; } public string SocialSecurityNumber { get; } private decimal grossSales; // gross weekly sales private decimal commissionRate; // commission percentage private decimal baseSalary; // base salary per week // six-parameter constructor public BasePlusCommissionEmployee(string firstName, string lastName, string socialSecurityNumber, decimal grossSales, decimal commissionRate, decimal baseSalary) { // implicit call to object constructor occurs here FirstName = firstName; LastName = lastName; SocialSecurityNumber = socialSecurityNumber; GrossSales = grossSales; // validates gross sales CommissionRate = commissionRate; // validates commission rate BaseSalary = baseSalary; // validates base…arrow_forwardIn C++ class bookType { public: void setBookTitle(string s); //sets the bookTitle to s void setBookISBN(string ISBN); //sets the private member bookISBN to the parameter void setBookPrice(double cost); //sets the private member bookPrice to cost void setQuantityInStock (int noOfCopies); //sets the private member quantityInStock to noOfCopies void printInfo() const; //prints the bookTitle, bookISBN, the bookPrice and the quantityInStock string getBookISBN() const; //returns the bookISBN double getBookPrice() const; //returns the bookPrice int showQuantityInStock() const; //returns the quantityInStock void updateQuantity(int addBooks); //adds addBooks to the quantityInStock, so that the quantity in stock now has it original value plus the parameter sent to this function private: string bookTitle; string bookISBN; double bookPrice; int quantityInStock; }; Write the full function definition for updateQuantity();arrow_forward
- Question p .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forward// This class discounts prices by 10% public class DebugFour4 { public static void main(String args[]) { final double DISCOUNT_RATE = 0.90; int price = 100; double price2 = 100.00; tenPercentOff(price DISCOUNT_RATE); tenPercentOff(price2 DISCOUNT_RATE); } public static void tenPercentOff(int p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println("Ten percent off " + p); System.out.println(" New price is " + newPrice); } public static void tenPercentOff(double p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println"Ten percent off " + p); System.out.println(" New price is " + newprice); } }arrow_forwardclass IndexItem { public: virtual int count() = 0; virtual void display()= 0; };class Book : public IndexItem { private: string title; string author; public: Book(string title, string author): title(title), author(author){} virtual int count(){ return 1; } virtual void display(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };class Category: public IndexItem { private: /* fill in the private member variables for the Category class below */ ? int count; public: Category(string name, string code): name(name), code(code){} /* Implement the count function below. Consider the use of the function as depicted in main() */ ? /* Implement the add function which fills the category with contents below. Consider the use of the function as depicted in main() */ ? virtualvoiddisplay(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY