LabExercises
LabExercises
Task-2
Add the Consturctors, setter/getter methods and Check its working properly using
the Main Method
Task -3
Task -4
Task -5
1. Create Java Class Book with details like int id, String bookName, String
author, double price.
2. Create a Java Class BookService Which will have overloaded methods to
calculate the discount .
3. One Method will take book Object as argument and calculate the discount on
the basis of price
a. use a simple if else ladder if Price < 500 5 % discount if price >500 and
price <1000 10 % and if price>1000 12%
4. Another Method will take book and customer type -> Corporate or Retail and
the discount will be calculated using both switch case(Using String-Java 7
feature)
and if else-if ladder
a. For Corporate Customer if Price < 500 7 % discount if price >500 and
price <1000 12 % and if price>1000 15%
b. For Retial Customer if Price < 500 5 % discount if price >500 and price
<1000 10 % and if price>1000 12%
5. Take the input for the application in the main method using scanner class
6. Try Invoking Both the Methods from the Main Method
Task-6
1. Create a Abstract Class Class Bank Account with two abstract methods double
deposit(double amount) , double withdraw(double amount)
2. Create two sub classes SavingsAccount and Business Account override deposit
and withdraw methods
3. SavingsAccount Holders are required to maintain a minimum balance of 5000
4. Business Account Holders are required to maintain a minimum balance of 25000
5. Saving Account holder can deposit upto 100000
6. Business Account Holder can deposit upto 1000000
Test both deposit and withdraw methods from the Main application
Task -7
Task -8
Task -9
Task -10
Task -11
Task -12
Task -13
int customerId;
String customerName;
long mobileNumber;
String email;
int invoiceNumber;
Customer customer;
double amount
4. Create a Java Class with the Annotation @Configuration and register the Customer
and
Invoice bean using the Factory Method with @Bean annotation
5. Test the application by accessing the Customer and invoice beans from the main
method
6. Create More than one Customer and observer the output , if there are any
exection thrown
make the suitable changes
Task -14
Task -16
QUIZ LINKS