Capgemini ADAPT 2022 Sprint 5 Book Rental B  Problem Solution – InvalidQuantity using Java

Capgemini ADAPT 2022 Book Rental A Sprint 5 Solution InvalidQuantity Problem Solution
Capgemini ADAPT 2022 Book Rental A Sprint 5 Solution InvalidQuantity Problem Solution

In this post, we have tried to provide a solution to the problem of Capgemini ADAPT 2022 Sprint 5 Book Rental A  Problem Solution (InvalidQuantity) using JAVA.

Note: The solutions are provided for your reference only. During the assessment, you are requested to not use any malpractices, rather than solve all the problems on your own. We do not encourage candidates to fall into any malpractice.

Book Rental A – S2_JBR-CS-S5-2-InvalidQuantity Problem Solution:


Write a program to create a class BookRental and define setters and getters along with para constructor and toString method as described in the problem statement.

Evaluate the quantity of BookRental for the given input. The constructor and the setter method of BookRental should throw InvalidQuantityException when the quantity is set less than 5 and handle it gracefully by displaying the cause of the abnormality.

Solution of InvalidQuantity:

import java.util.*;

class Book {
int bookId;
String title;
String description;
String author;
double price;
int totalQuantity;
int availableQuantity;
double rentPerDay;

public Book(int bookId, String title, String description, String author,double price,int totalQuantity, int availableQuantity,
double rentPerDay) {
this.bookId = bookId;
this.title = title;
this.description = description;
this.author = author;
this.totalQuantity = totalQuantity;
this.availableQuantity = availableQuantity;
this.price = price;
this.rentPerDay = rentPerDay;
}
public Book() {}
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getTotalQuantity() {
return totalQuantity;
}

public void setTotalQuantity(int totalQuantity) {
this.totalQuantity = totalQuantity;
}
public int getAvailableQuantity() {
return availableQuantity;
}
public void setAvailableQuantity(int availableQuantity) {
this.availableQuantity = availableQuantity;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getRentPerDay() {
return rentPerDay;
}
public void setRentPerDay(double rentPerDay) {
this.rentPerDay = rentPerDay;
}
@Override
public String toString() {
return “Book [bookId=” + bookId + “, title=” + title + “, description=” + description + “, author=” + author+
“, price=” + price+ “, totalQuantity=” + totalQuantity + “, availableQuantity=” + availableQuantity +
“, rentPerDay=” + rentPerDay + “]”;
}
}
class Admin {
int adminId;
String emailId;
String password;
String firstName;
public Admin(int adminId, String emailId, String firstName,String password ) {
super();
this.adminId = adminId;
this.emailId = emailId;
this.password = password;
this.firstName = firstName;
}
public Admin() {}
public int getAdminId() {
return adminId;
}
public void setAdminId(int adminId) {
this.adminId = adminId;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Override
public String toString() {
return “Admin [adminId=” + adminId + “, emailId=” + emailId + “, firstName=”
+ firstName +”, password=” + password+ “]” ;
}
}


BOOK RENTAL A ALL SOLUTIONS CLICK HERE

 

BOOK RENTAL B ALL SOLUTIONS CLICK HERE

Top Companies + Batchwise Hiring Drive:


TOP COMPANIES HIRING DRIVE BATCHWISE HIRING DRIVES
1. TCS OFF-CAMPUS DRIVES 1. 2018 BATCH
2. INFOSYS OFF-CAMPUS DRIVES 2. 2019 BATCH
3. COGNIZANT OFF-CAMPUS DRIVES 3. 2020 BATCH
4. WIPRO OFF-CAMPUS DRIVES 4. 2021 BATCH
5. CAPGEMINI OFF-CAMPUS DRIVES 5. 2022 BATCH

To Stay Up-to-date, Follow us on Social Media:


1.      Join our Telegram Channel: Click Here
2.      Like us on Facebook: Click Here
3.      Follow us on Instagram: Click Here
4.      Follow us on LinkedIn: Click Here
5.      Follow us on Google News: Click Here

ADAPT Different Coding Solutions:


  1. Largest Array Solution – Click Here
  2. Batsman & Bowler Solution – Click Here
  3. Instruments Problem Solution – Click Here
  4. Check Two Person Are Same – Click Here
  5. Medicine App ADAPT Solution – Click Here
  6. String Combination Capgemini ADAPT Solution – Click Here
  7. Remove”X”inString Problem Solution – Click Here
  8. Customer and Invoice ADAPT Problem Solution – Click Here
  9. Book and Author Problem Solution – Click Here
  10. Highest Feedback Problem Solution – Click Here
  11. Registered Customer Problem Solution in Java – Click Here
  12. Product of Digits Problem Solution – Click Here
  13. Change Using Minimal Coins/Notes Solution in Java – Click Here

Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):


  • 1. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerInAscendingOrder Problem Solution
  • 2. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerByFirstName Problem Solution
  • 3. Capgemini ADAPT Sprint 1 Bus Reservation System – SortByCustomerId Problem Solution
  • 4. Capgemini ADAPT Sprint 1 Solution Java | LSAByCustomerName Problem Solution
  • 5. Capgemini ADAPT Sprint 1 Case Study Solution Java | BSAByCustomerId Problem Solution

Capgemini ADAPT Sprint 2 (Bus Reservation System):


  • 1. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution | HAS-A-Relationship Solution Java
  • 2. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution OOPs-Para-Constructor Java
  • 3. Capgemini ADAPT Sprint 2 Bus Reservation System (CRUDOperations) Problem Solution

ADAPT Sprint 3 Solutions – Capgemini (Toy Rental A):


Online Shopping A Solutions Using Java:


  • 1. Capgemini ADAPT 2022 Online Shopping A – Display Products Solution using JAVA – Click Here
  • 2. Capgemini ADAPT 2022 Online Shopping A – Products by Category Solution using JAVA – Click Here
  • 3. Capgemini ADAPT 2022 Online Shopping A – Customer Array Solution using JAVA – Click Here
  • 4. Capgemini ADAPT 2022 Online Shopping A – Search Customers by Name Solution using JAVA – Click Here
  • 5. Capgemini ADAPT 2022 Online Shopping A – Search Customers by City Solution using JAVA – Click Here
  • 6. Online Shopping A – Customer & Rentress Class Solution | Capgemini ADAPT 2022 Solutions – Click Here