LEX Assignments5645654654
LEX Assignments5645654654
LEX Assignments5645654654
---------
DAY 1
------------
1. class Tester {
public static void main(String[] args) {
System.out.println("My name is Sonakshi Gupta.\n My designation is System
Engineer.");
// Implement your code here
}
}
2. class Tester {
public static void main(String[] args) {
System.out.println("House no: 761 \n Ward No. 37 \n City: Jammu \n Pin code:
180007");
// Implement your code here
}
}
-----------
DAY 2
-----------
1. class Tester {
public static void main(String[] args) {
int principal=5000;
float rate= 10.0f;
byte time= 5;
float interest= 0.0f;
System.out.println((principal*rate*time)/100);
// Implement your code here
}
}
2. class Tester {
public static void main(String[] args) {
int principal=5000;
float rate= 10.0f;
byte time= 5;
float interest= 0.0f;
System.out.println((principal*rate*time)/100);
int prin=3250;
float r= 7.0f;
byte t= 3;
float Sinterest= 0.0f;
System.out.println((prin*r*t)/100);
4. class Tester {
public static void main(String[] args) {
float fahr= 32;
float far= 50;
float cels= (float)(((fahr-32)/9)*5);
float cel= (float)(((far-32)/9)*5);
System.out.println(cels);
System.out.println(cel);
}
}
-----------
DAY 3
---------
1. class Tester {
public static void main(String[] args) {
int num1=3;
int num2=4;
int num3=1;
if(num1>num2)
{
if(num1>num3)
{System.out.println(num1+ " is the maximum number");
}
else
{System.out.println(num3+ " is the maximum number");
}
}
else {
{System.out.println(num2+ " is the maximum number");
}
}
}
}
2. REVERSE OF A NUMBER
---------
class Tester {
public static void main(String[] args) {
int inputNumber = 7865;
int sumOfDigits = 0;
int temp = 0;
---------
TREATING ININITE WHILE LOOP
-----------
class Tester {
public static void main(String[] args) {
int totalCost = 0;
char wantToAddFoodItem = 'Y';
int unitPrice = 10;
int quantity = 1;
do {
temp = inputNumber % 10;
sumOfDigits += temp;
inputNumber = inputNumber / 10;
} while (inputNumber > 0);
--------------
class Tester {
public static void main(String[] args) {
for (int row = 1; row <= 4; row++) {
for (int value = 1; value <= row; value++) {
System.out.print(value + " ");
}
System.out.println();
}
}
}
-----------------
8. FACTORIAL OF A NUMBER
------------
class Tester {
public static void main(String[] args) {
int a=5;
int temp=1;
while(a!=0)
{
temp= temp*a;
a--;
}
System.out.println(temp);
// Implement your code here
}
}
9. GEOMETRIC SEQUENCE
---------------------
class Tester {
public static void main(String[] args) {
int a=1, r=2, n=5;
int z=1;
for(int i=1;i<=n;i++)
{
System.out.println(z);
int x= (int)Math.pow(r,i);
z=a*x;
}
}
}
----------------------------
*SELECTION CONTROL STRUCTURE ASSIGNMENT*
---------------
1. class Tester {
public static void main(String[] args) {
int a=5, b=5;
int sum=0;
if(a==b)
{sum= a+b;
}
else{
sum= 2*(a+b);
}
System.out.println(sum);
}
}
-------------------
2. class Tester {
public static void main(String[] args) {
int a=1, b=4, c=6;
float dis=0f;
float x1=0f;
float x2=0f;
dis= (float)((b*b)-4*a*c);
System.out.println(dis);
if(dis==0)
{
System.out.println("the value of roots are equal: ");
}
else if(dis>0)
{
System.out.println("the value of roots are unequal: ");
}
else{
System.out.println("the value of roots are not real: ");
}
x1= (float)((-b+dis)/(2*a));
x2= (float)((-b-dis)/(2*a));
System.out.println(x1);
System.out.println(x2);
}
}
--------------
3. class Tester {
public static void main(String[] args) {
int a=2, b=6, c=7;
int x=0;
if(a==7)
{
x= b*c;
}
else if(b==7)
{
x=c;
}
else if(c==7)
{
x=-1;
}
else
{
x= a*b*c;
}
System.out.println(x);
}
}
--------------
4. class Tester {
public static void main(String[] args) {
char foodType='N';
int quan= 0;
int dist= 1;
int m=dist;
int output= 0;
int total=0;
int extra=0;
int extra1=1;
int extra2=2;
int cost=0;
int charge=0;
int sona=0;
if(foodType=='N')
{
cost= 15;
}
else{
cost= 12;
}
if (quan>= 1)
{
total= cost* quan;
System.out.println("total cost is $" + total);
}
else{
System.out.println("Invalid selection");
output = -1;
System.out.println("total bill amount is:" + output);
System.out.println("order cannot be placed");
}
if(dist>=1)
{
if (dist<=3)
{
System.out.println("no delivery charges");
}
else if(dist<=6)
{
System.out.println("Additional delivery charges for $1 per km");
extra= dist*extra1;
}
else if(dist<=m)
{
System.out.println("Additional delivery charges of $3 and $2 per km");
extra= 3+ ((dist-6)*extra2);
}
output= total+ extra;
System.out.println("your order has been successfully placed worth $" + output);
}
else
{
System.out.println("invalid selection " + " order cannot be placed");
}
}
}
--------------------
5. class Tester {
public static void main(String[] args) {
int accnmbr=1001;
int accbal= 250000;
int salary= 40000;
String loantype= "Car";
int loanAmExpected= 300000;
int emis= 30;
int count=0;
int eligibleloanAmount= 500000;
int eligibleEmis= 36;
int a= accnmbr;
while(a!=0)
{
a=a/10;
count++;
}
if(count==4)
{
int firstdigit=accnmbr/1000;
if(firstdigit==1)
{
System.out.println("You can proceed further ");
}
}
else{
System.out.println("LOAN WILL NOT BE PROVIDED!!!");
}
if(accbal>=1000)
{
System.out.println("You are eligible for loan!");
}
else{
System.out.println("LOAN WILL NOT BE PROVIDED!!!");
}
System.out.println("Checking whether the bank approves for loan");
if(loanAmExpected<= eligibleloanAmount)
{
if(emis<=eligibleEmis)
{
System.out.println("LOAN APPROVED!!!");
System.out.println("Account number: " + accnmbr);
System.out.println("Loan type: " + loantype);
System.out.println("Eligible loan amount: " + eligibleloanAmount);
System.out.println("Loan amount requested: " + loanAmExpected);
System.out.println("Number of eligible EMIs: " + eligibleEmis);
System.out.println("Number of requested EMIs: " + emis);
}
}
else{
System.out.println("BANK CANNOT PROVIDE LOAN TO YOUR ACCOUNT!!!");
}
}
}
----------------
6. class Tester {
public static void main(String[] args) {
int x=2,y=4,z=21;
int n1=0;
int n5=0;
for(int i=1; i<=y; i++)
{
if(z>=5)
{
n5=z/5;
z=z-(n5*5);
}
}
---------------------------------------------------
7. class Tester {
public static void main(String[] args) {
int day=1;
int month=9;
int year=15;
if(month==1|| month==3|| month==5|| month==7|| month==8|| month==10)
{
if(day==31)
{
day=1;
month=month + 1;
}
else{
day=day+1;
}
}
else if(month==2)
{
if(((year%4==0) && (year%100!=0)) || (year%400==0))
{
System.out.println("Leap year");
if(day==29)
{
day=1;
month=month+1;
}
else{
day= day+1;
}
}
else{
if(day==28)
{
day=1;
month=month+1;
}
else{
day=day+1;
}
}
}
else if(month==4|| month==6|| month==9|| month==11)
{
if(day==30)
{
day=1;
month=month + 1;
}
else{
day=day+1;
}
}
else
{
if(day==31)
{
day=1;
month=1;
year=year+1;
}
else
{
day=day+1;
}
}
System.out.print(day + "-");
System.out.print(month + "-");
System.out.print("20" + year);
}
}
---------------------------------------------------------------------
8. class Tester {
public static void main(String[] args) {
int n=3;
if(n%3==0 && n%5==0)
{
System.out.println("Zoom");
}
else if(n%5==0)
{
System.out.println("Zap");
}
else if(n%3==0)
{
System.out.println("Zip");
}
else
{
System.out.println("Invalid");
}
}
}
-------------------
*ITERATION CONTROL STRUCTURE*
-------------
1. class Tester {
public static void main(String[] args) {
int a=46763;
int n=a;
int rem=0;
int quo=0;
while(a!=0)
{
rem=a%10;
quo=(quo*10)+rem;
a=a/10;
}
System.out.println("Reverse of given number is: " + quo);
if(quo==n)
{
System.out.println(n + " is a pallindrome number");
}
else{
System.out.println(n + " is not a pallindrome number");
}
}
}
-----------------
2. class Tester {
public static void main(String[] args) {
int heads=150, legs=500;
int r=0, c=0;
if((heads>legs)|| (heads==0) || (legs%2!=0))
{
System.out.println("The number of chickens and rabbits cannot be found");
}
else{
r= (int)((legs+(-2*heads))/2);
c= (int)(heads-r);
System.out.println("Chickens= " + c);
System.out.println("Rabbits= " + r);
}
}
}
----------------------
3. class Tester {
public static void main(String[] args) {
int a=123, n=a, rem=0, temp=0, sum=0;
while(n!=0)
{
temp=n%10;
sum= sum+temp;
n=n/10;
}
System.out.println("sum of digits= " + sum);
rem=a%sum;
if(rem==0)
{
System.out.println(a + " is divisible by sum of its digits");
}
else{
System.out.println(a + " is not divisible by sum of its digits");
}
}
}
--------------------------
4. class Tester {
public static void main(String[] args) {
int x=45, y=1000, rem=0, temp=0, rev=0, a=x;
while(a!=0)
{
rem=a%10;
a=a/10;
temp=y*rem;
}
if(temp==y)
{
System.out.println(x + " is a seed of " + y);
}
else{
System.out.println(x + " is not a seed of " + y);
}
}
}
----------------------
5. class Tester {
public static void main(String[] args) {
int a=1635;
int n=a;
int rem=0;
int rev=0;
double temp=0;
int sum=0;
while(a!=0)
{
rem=a%10;
a=a/10;
temp=Math.pow(rem, 3);
sum=(int) (sum+ temp);
}
System.out.println(sum);
if(sum==n)
{System.out.println(n + " is an Armstrong number");
}
else{
System.out.println(n + " is not an armstrong number");
}
}
}
---------------
6. class Tester {
public static void main(String[] args) {
String a="1623";
int sum=0;
for(int i=1; i<= a.length(); i=i+2)
{
int temp= a.charAt(i)-'0';
sum=sum+(temp*temp);
}
if(sum%9==0)
{
System.out.println(a + " is a lucky number");
}
else
{
System.out.println(a + " is not a lucky number");
}
}
}
--------------------------
7. class Tester {
public static void main(String[] args) {
int num1=7, num2=9, lcm=0, max=0;
if(num1>num2)
max=num1;
else
max=num2;
int step=max;
while(num1!=0)
{
if(max%num1==0 && max%num2==0)
{
lcm=max;
break;
}
max=max+step;
}
System.out.println(lcm);
}
}
--------------------
8. class Tester {
public static void main(String[] args) {
int n=5;
for(int i=1; i<=n;i++)
{
for(int j=n;j>=i;j--)
{
System.out.print("*" +" " );
}
System.out.println();
}
}
}
----------------------
------------------------------------------------------------------
DAY 4
----------------------
1. CLASS INTRODUCTION TRYOUT
class Customer {
class Tester {
// Object creation
Customer customer = new Customer();
}
------------------
2. CLASS AND OBJECT-EXERCISE 1
class Customer {
class Tester {
// Object creation
Customer customer = new Customer();
}
----------------------------
3. LOCAL VARIABLE-TRYOUT
class Demo {
public int var1; // Instance variable of the class
class Tester {
}
----------------------
4. *METHODS- EXERCISE 1*
class Calculator {
public double findAverage(int number1, int number2, int number3)
{
double sum= (number1+number2+number3);
double average= sum/3;
double roundoff= Math.round(average*100.0)/100.0;
return roundoff;
class Tester {
// Invoke the method findAverage of the Calculator class and display the average
}
}
--------------------------
DAY 5
----
1. CONSTRUCTOR AND THIS KEYWORD: EXERCISE 1
class Customer {
class Tester {
customer.displayCustomerDetails();
}
------------------------
*METHODS-ASSIGNMENT*
1. class Order{
public int orderId;
public String orderedFood;
public double totalPrice;
public String status;
}
}
class Tester{
public static void main(String args[]){
Order o= new Order();
o.orderId= 101;
o.orderedFood= "Pasta";
o.status= "ordered";
double x= o.calculateTotalPrice(100);
o.displayDetails();
System.out.println("Total Price: " + x);
}
}
-----------------------
2. class Restaurant{
public float rating;
public String restaurantName;
public long restaurantContact;
public String restaurantAddress;
class Tester {
// Invoke the method sumOfDigits of Calculator class and display the output
}
}
-----------------------
4. class Rectangle {
public float length;
public float width;
public double calculateArea()
{
double a= length* width;
double area= Math.round(a*100.0)/100.0;
return area;
}
public double calculatePerimeter()
{
double p= 2* (length+ width);
double perimeter= Math.round(p*100.0)/100.0;
return perimeter;
}
}
class Tester {
public static void main(String args[]) {
//Invoke the methods of the Rectangle class to calculate the area and perimeter
double x= rectangle.calculateArea();
double y= rectangle.calculatePerimeter();
//Display the area and perimeter using the lines given below
System.out.println("Area of the rectangle is " + x);
System.out.println("Perimeter of the rectangle is " + y);
}
}
-------------------
*CONSTRUCTORS AND THIS KEYWORD*
1. class Order{
public int orderId;
public String orderedFood;
public double totalPrice;
public String status;
public Order()
{
status= "ordered";
}
public Order(int orderId, String orderedFood)
{
this.orderId= orderId;
this.orderedFood= orderedFood;
status="Ordered";
}
}
class Tester{
public static void main(String args[]){
Order o1= new Order();
System.out.println("Status of order 1: " + o1.status);
Order o2= new Order(1001, "Pizza");
System.out.println("Status of order 2: " + o2.status);
System.out.println("Order Id of order 2: " + o2.orderId);
System.out.println("Ordered Food for order 2: " + o2.orderedFood);
}
}
----------------------
2. class Restaurant{
public float rating;
public String restaurantName;
public long restaurantContact;
public String restaurantAddress;
class Employee {
class Tester {
employee.calculateSalary();
System.out.println("Employee Details");
System.out.println("Employee Id: " + employee.getEmployeeId());
System.out.println("Employee Name: " + employee.getEmployeeName());
System.out.println("Salary: " + employee.getSalary());
}
}
-----------------------
*ENCAPSULATION ASSIGNMENT*
1. class Order{
private int orderId;
private String orderedFood;
private double totalPrice;
private String status;
}
class Tester{
public static void main(String args[]){
Order o= new Order();
o.setOrderId(101);
o.setOrderedFood("Pasta");
o.setStatus("ordered");
double x= o.calculateTotalPrice(100);
}
}
---------------------
2. class MovieTicket {
private int movieId;
private int noOfSeats;
private double costPerTicket;
switch(movieId)
{
case 111: costPerTicket= 7;
break;
case 112: costPerTicket=8;
break;
case 113: costPerTicket=8.5;
break;
default: costPerTicket=0;
}
a= costPerTicket*noOfSeats;
double amount= a*(1+(2/100.0));
return amount;
}
}
class Tester {
public static void main(String[] args) {
MovieTicket movieTicket = new MovieTicket(112, 3);
movieTicket.setCostPerTicket(7);
double amount = movieTicket.calculateTotalAmount();
if (amount==0)
System.out.println("Sorry! Please enter valid movie Id and number of seats");
else
System.out.println("Total amount for booking : $" + Math.round(amount*100)/100.0);
}
}
-----------------
*STRING METHODS-TRYOUT*
class Tester {
public static void main(String args[]) {
// length()
String str = "Welcome";
System.out.println(str.length());
// concat()
String s = "Hello";
s.concat(" World");
System.out.println(s);
// s is still "Hello"
// String objects are immutable which means they cannot be changed
// Here, when we concat the two strings a new string object gets created
String s1 = s.concat("World");
System.out.println(s1);
// equals()
System.out.println(s.equals("Hello"));
// == compares the object reference and will return false in the below
// case
System.out.println(s == s2);
// equalsIgnoreCase()
System.out.println(s.equalsIgnoreCase("hello"));
// substring()
String subs = "Learning is fun";
System.out.println(subs.substring(4, 8));
System.out.println(subs.substring(4));
// charAt()
System.out.println(subs.charAt(10));
// contains()
System.out.println(subs.contains("is"));
// replace()
System.out.println(subs.replace('i', 'k'));
}
}
-----------------------
*STRING EXERCISE*
class Tester{
// Displaying 2D array
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 2; j++) {
if (j == 0)
System.out.println("Max Temperature is "
+ dayWiseTemperature[i][j] + " on day " + i);
else
System.out.println("Min Temperature is "
+ dayWiseTemperature[i][j] + " on day " + i);
}
}
}
}
----------------------
*ARRAY-EXERCISE 1*
class Tester {
}
---------------------
2. class Tester{
public static boolean checkPalindrome(String str){
int length= str.length();
String rev= "";
---------------------------------------
----------------------------
*ARRAY-ASSIGNMENTS*
----
1. class Teacher {
private String teacherName;
private String subject;
private double salary;
public void setTeacherName(String teacherName){
this.teacherName= teacherName;
}
class Tester {
public static void main(String[] args) {
return ans;
}
class Tester{
public static void main(String[] args) {
int[] marks = { 79, 87, 97, 65, 78, 99, 66 };
Student student = new Student(marks);
student.findGrade();
System.out.println("Grades corresponding to the marks are : ");
char[] grades = student.getGrade();
for (int index = 0; index < grades.length; index++) {
System.out.print(grades[index] + " ");
}
}
}
----------------------
5. class Tester {
int a = 0;
for(int i = num1 >= 10? num1+1 : 10; i <= num2 && i < 100; i++){
if(i % 5 == 0 && i % 3 == 0) numbers[a++] = i;
}
return numbers;
}
}
}
-----------------------
6. class Tester {
public static int findTotalCount(int[] numbers) {
int length= numbers.length;
int count=0;
for(int i=0; i<length-1; i++)
{
if(numbers[i]==numbers[i+1])
{
count= count+1;
}
}
return count;
}
----------------------------
7. class Tester{
public static String[] findPermutations(String str){
//Implement your code here and change the return value accordingly
static {
System.out.println("Tester class loaded");
}
}
class Car {
private static String color;
private static int numberOfCars = 0;
static {
System.out.println("Car class loaded");
}
static{
counter=9000;
}
public Bill(String paymentMode){
this.paymentMode= paymentMode;
billId= "B" + ++counter;
}
class Tester {
public static void main(String[] args) {
//Create more objects and add them to the bills array for testing your code
---------------
*AGGREGATION AND ACCESS MODIFIERS- TRYOUT*
class Subject {
private String subjectName;
public void setSubjectName(String subjectName){
this.subjectName= subjectName;
}
Subject(String subjectName) {
this.subjectName = subjectName;
}
}
class Student {
private int rollNo;
private String studentName;
private Subject subject;
// Add the getter and setter methods to class Subject and modify the
// displayDetails method accordingly
class Customer{
private String customerId;
private String customerName;
private long contactNumber;
private Address address;
Customer(){
}
Customer(String customerId, String customerName, long contactNumber, Address address){
this.customerId= customerId;
this.customerName= customerName;
this.contactNumber= contactNumber;
this.address= address;
}
Customer(String customerName, long contactNumber, Address address){
this.customerName= customerName;
this.contactNumber= contactNumber;
this.address= address;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public long getContactNumber() {
return contactNumber;
}
public void setContactNumber(long contactNumber) {
this.contactNumber = contactNumber;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public void displayCustomerDetails(){
System.out.println("Customer Id is: " + getCustomerId());
System.out.println("Customer Name is: "+ getCustomerName());
System.out.println("Contact Number is: " + getContactNumber());
System.out.println("Address is: " + Address.getCity()+ " " + Address.getStreet());
}
public double payBill(double totalPrice)
{
totalPrice= totalPrice + 5.0;
return totalPrice;
}
}
class Tester {
}
------------------------
*ASSOCIATION EXERCISE*
class CabServiceProvider{
private static final String String = null;
private String cabServiceName;
private int totalCabs;
public CabServiceProvider(String cabServiceName, int totalCabs){
this.cabServiceName= cabServiceName;
this.totalCabs= totalCabs;
}
public String getCabServiceName() {
return cabServiceName;
}
public void setCabServiceName(String cabServiceName) {
this.cabServiceName = cabServiceName;
}
public int getTotalCabs() {
return totalCabs;
}
public void setTotalCabs(int totalCabs) {
this.totalCabs = totalCabs;
}
public double calculateRewardPrice(Driver driver){
double bonus=0.0;
double rewardAmount=0.0;
if(cabServiceName.equals("Halo")){
if(driver.getAverageRating()>= 4.5 && driver.getAverageRating()<=5){
rewardAmount= 10*driver.getAverageRating();
}
else if(driver.getAverageRating()>= 4 && driver.getAverageRating()<4.5){
rewardAmount= 5*driver.getAverageRating();
}
else {
rewardAmount= 0.0;
}
}
else if(cabServiceName.equals("Aber")){
if(driver.getAverageRating()>= 4.5 &&
driver.getAverageRating()<=5){
rewardAmount= 8*driver.getAverageRating();
}
else if(driver.getAverageRating()>= 4 &&
driver.getAverageRating()<4.5){
rewardAmount= 3*driver.getAverageRating();
}
else {
rewardAmount= 0.0;
}
}
else{
rewardAmount=0.0;
}
bonus= Math.round(rewardAmount*100.0)/100.0;
return bonus;
}
}
class Driver {
class Tester {
//Create more objects of CabServiceProvider and Driver classes for testing your
code
}
}
----------------
*ASSIGNMENTS*
-----
STATIC
---------------
1. package aggregation;
class Food {
public String foodName;
public String cuisine;
public String foodType;
public int quantityAvailable;
public double unitPrice;
}
class Order{
private static int orderCounterId;
private int orderId;
private Food[] orderedFoods;
private double totalPrice;
private String status;
static{
orderCounterId= 100;
}
public Order(){
}
public Order(Food[] orderedFoods){
this.orderedFoods= orderedFoods;
orderId= ++orderCounterId;
}
public static int getOrderCounterId() {
return orderCounterId;
}
public static void setOrderCounterId(int orderCounterId) {
Order.orderCounterId = orderCounterId;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public Food[] getOrderedFoods() {
return orderedFoods;
}
public void setOrderedFoods(Food[] orderedFoods) {
this.orderedFoods = orderedFoods;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public static int getTotalNoOfOrders(){
return(Order.orderCounterId - 100);
}
public double calculateTotalPrice(String paymentMode) {
double foodPrice = 0;
double finalPrice = 0;
float serviceCharge = 0f;
int unitPrice = 100;
foodPrice+=unitPrice*1;
if (paymentMode.equals("Credit Card") || paymentMode.equals("Debit Card")) {
serviceCharge = 2.0f;
}
else if (paymentMode.equals("PayPal")) {
serviceCharge = 2.9f;
}
finalPrice = foodPrice+foodPrice*(serviceCharge/100);
this.setTotalPrice(finalPrice);
return finalPrice;
}
}
class Tester2 {
public static void main(String args[]) {
Food food1 = new Food();
Food food2 = new Food();
Food food3 = new Food();
Food food4 = new Food();
Food food5 = new Food();
}
class AssignmentStatic2 {
//Create more objects and add them to the participants array for testing your
code
}
--------------------
3. class Booking{
private String customerEmail;
private int seatsRequired;
private boolean isBooked;
private static int seatsAvailable;
static{
seatsAvailable= 400;
}
public Booking (String customerEmail,int seatsRequired){
this.customerEmail= customerEmail;
this.seatsRequired= seatsRequired;
if( seatsRequired<=seatsAvailable){
isBooked= true;
seatsAvailable= seatsAvailable-seatsRequired;
}
else{
isBooked= false;
}
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public int getSeatsRequired() {
return seatsRequired;
}
public void setSeatsRequired(int seatsRequired) {
this.seatsRequired = seatsRequired;
}
public boolean isBooked() {
return isBooked;
}
public void setBooked(boolean isBooked) {
this.isBooked = isBooked;
}
public static int getSeatsAvailable() {
return seatsAvailable;
}
public static void setSeatsAvailable(int seatsAvailable) {
Booking.seatsAvailable = seatsAvailable;
}
class Tester {
public static void main(String[] args) {
Booking booking1 = new Booking("[email protected]", 100);
Booking booking2 = new Booking("[email protected]", 350);
//Create more objects and add them to the bookings array for testing your code
class Address{
private String doorNo;
private static String street;
private static String city;
private int zipcode;
Address(String doorNo, String street, String city, int zipcode){
this.doorNo= doorNo;
Address.street= street;
Address.city= city;
this.zipcode= zipcode;
}
public String getDoorNo() {
return doorNo;
}
public void setDoorNo(String doorNo) {
this.doorNo = doorNo;
}
public static String getStreet() {
return street;
}
public void setStreet(String street) {
Address.street = street;
}
public static String getCity() {
return city;
}
public void setCity(String city) {
Address.city = city;
}
public int getZipcode() {
return zipcode;
}
public void setZipcode(int zipcode) {
this.zipcode = zipcode;
}
}
class Customer{
private String customerId;
private String customerName;
private long contactNumber;
private Address address;
public Customer(){
}
public Customer(String customerId,String customerName,long contactNumber,Address
address){
this.customerId= customerId;
this.customerName= customerName;
this.contactNumber= contactNumber;
this.address= address;
}
public Customer(String customerName,long contactNumber,Address address){
this.customerName= customerName;
this.contactNumber= contactNumber;
this.address= address;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public long getContactNumber() {
return contactNumber;
}
public void setContactNumber(long contactNumber) {
this.contactNumber = contactNumber;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public boolean generateBill(Order order) {
System.out.println("Bill details \n***********");
System.out.println("Items ordered : ");
for (Food food : order.getOrderedFoods()) {
System.out.println(food.getFoodName());
}
double payableAmount = order.calculateTotalPrice("Credit Card");
System.out.println("Payable Amount : $" + (int) (payableAmount * 100)
/ 100.0);
return true;
}
public void displayCustomerDetails(){
System.out.println("Customer Id is: " + getCustomerId());
System.out.println("Customer Name is: "+ getCustomerName());
System.out.println("Contact Number is: " + getContactNumber());
System.out.println("Address is: " + Address.getCity()+ " " + Address.getStreet());
}
}
class Order{
private static int orderCounterId;
private int orderId;
private Food[] orderedFoods;
private double totalPrice;
private String status;
private Customer customer;
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
static{
orderCounterId= 100;
}
public Order(){
}
public Order(Food[] orderedFoods, Customer customer){
this.orderedFoods= orderedFoods;
this.customer= customer;
orderId= ++orderCounterId;
}
public static int getOrderCounterId() {
return orderCounterId;
}
public static void setOrderCounterId(int orderCounterId) {
Order.orderCounterId = orderCounterId;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public Food[] getOrderedFoods() {
return orderedFoods;
}
public void setOrderedFoods(Food[] orderedFoods) {
this.orderedFoods = orderedFoods;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public static int getTotalNoOfOrders(){
return(Order.orderCounterId - 100);
}
public double calculateTotalPrice(String paymentMode) {
double foodPrice = 0;
double finalPrice = 0;
float serviceCharge = 0f;
for (Food food : orderedFoods) {
foodPrice+=food.getUnitPrice()*1;
}
if (paymentMode.equals("Credit Card") || paymentMode.equals("Debit Card")) {
serviceCharge = 2.0f;
}
else if (paymentMode.equals("PayPal")) {
serviceCharge = 2.9f;
}
finalPrice = foodPrice+foodPrice*(serviceCharge/100);
this.setTotalPrice(finalPrice);
return finalPrice;
}
}
public class Tester {
}
--------------------------
2. class Author{
private String name;
private String emailId;
private char gender;
public Author(String name, String emailId, char gender){
this.name= name;
this.emailId= emailId;
this.gender=gender;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public char getGender() {
return gender;
}
public void setGender(char gender) {
this.gender = gender;
}
}
class Book{
private String name;
private double price;
private int quantity;
private Author author;
public Book(String name, double price, int quantity, Author author){
this.name=name;
this.price=price;
this.quantity=quantity;
this.author=author;
}
public void displayAuthorDetails(){
System.out.println("Displaying author details");
System.out.println("Author Name: "+ author.getName());
System.out.println("Author Email Id: "+ author.getEmailId());
System.out.println("Author Gender: "+ author.getGender());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
}
class Tester1 {
public static void main(String args[]){
Author author1= new Author("Joshua Bloch", "[email protected]", 'M');
Book book1= new Book("Effective Java 1", 45.0, 15, author1);
book1.displayAuthorDetails();
}
}
----------------------
3. class Room {
class Member {
//Implement your code here
class Admin {
//Implement your code here
public void assignRoom(Room[] rooms, Member member){
for(Room room: rooms){
if(room.getCapacity()>0 && room.getCapacity()<=4){
member.setRoom(room);
room.setCapacity(room.getCapacity()-1);
break;
}
}
}
}
class Tester {
public static void main(String args[]) {
Room room1 = new Room();
Room room2 = new Room();
Room room3 = new Room();
Room room4 = new Room();
Room room5 = new Room();
-------------------------
----------------------------------------
DAY 2
--------
*CONSTRUCTOR CALL IN INHERITANCE- TRYOUT*
----------
class Employee {
Employee() {
System.out.println("Employee constructor invoked");
}
}
class Tester {
public static void main(String[] args) {
Manager manager = new Manager();
}
}
------------------
*NEED FOR SUPER CONSTRUCTORS= TRYOUT*
----------
class Customer {
public Customer() {
System.out.println("Parent parameterless constructor");
}
this.setCustomerId(custId);
this.setCustomerName(custName);
this.discount = 5.0f;
System.out.println("Child parameterized constructor");
}
class Tester {
}
}
-----------------------
*INHERITANCE TRYOUT*
---------
class Employee {
int employeeId;
String employeeName;
// Parameterized constructor
Employee(int employeeId, String employeeName) {
this.employeeId = employeeId;
this.employeeName = employeeName;
}
class Tester {
public static void main(String[] args) {
Manager obj = new Manager(101, "John", "Lead");
obj.display();
System.out.println("Designation: " + obj.getDesignation());
}
}
---------------------
*INHERITANCE-EXERCISE 1*
------
class Camera {
private String brand;
private double cost;
public Camera() {
this.brand = "Nikon";
}
public Camera(String brand, double cost){
this.brand=brand;
this.cost= cost;
}
class Tester {
public static void main(String[] args) {
DigitalCamera camera = new DigitalCamera("Canon",100);
System.out.println(camera.getBrand()+" "+camera.getCost()+" "+camera.getMemory());
}
}
------------------------
*METHOD OVERLOADING- TRYOUT*
------
class Shape {
class Tester {
class Tester {
}
public double getWage() {
return wage;
}
public void setWage(double wage) {
this.wage = wage;
}
public float getHoursWorked() {
return hoursWorked;
}
public void setHoursWorked(float hoursWorked) {
this.hoursWorked = hoursWorked;
}
public String toString(){
return "ContractEmployee\nemployeeId: "+this.getEmployeeId()+"\nemployeeName:
"+this.getEmployeeName()+"\nsalary: "+this.getSalary()+"\nwage:
"+this.getWage()+"\nhoursWorked: "+this.getHoursWorked();
}
}
class Tester {
----------------
*METHOD OVERLOADING ASSIGNMENT 1*
--------
class Bill{
//Implement your code here
public double findPrice(int itemId){
double price=0;
switch (itemId){
case 1001: price=25;
break;
case 1002: price=20;
break;
case 1003: price=23;
break;
case 1004: price=18;
break;
default: price=0;
}
return price;
}
public double findPrice(String brandName, String itemType, int size){
double price=0;
if(brandName.equals("Puma")){
if(itemType.equals("T-shirt")){
if(size==34 || size==36){
price=25;
}
}
else if(itemType.equals("Skirt")){
if(size==38 || size==40){
price=20;
}
}
}
else if(brandName.equals("Reebok")){
if(itemType.equals("T-shirt")){
if(size==34 || size==36){
price=23;
}
}
else if(itemType.equals("Skirt")){
if(size==38 || size==40){
price=18;
}
}
}
return price;
}
}
class Tester {
price = bill.findPrice("Reebok","T-shirt",34);
if(price>0)
System.out.println("Price of the selected item is $"+price);
else
System.out.println("The values are not valid");
}
}
---------------------
*METHOD-OVERLOADING ASSIGNMENT 2*
-------
class Point{
//Reuse the code of Method Overloading - Exercise 1
class Triangle {
//Implement your code here
private Point point1;
private Point point2;
private Point point3;
public Triangle(){
point1= new Point(0,0);
point2= new Point(1,1);
point3= new Point(2,5);
}
public Triangle(double point1XCoordinate,double point1YCoordinate,double
point2XCoordinate,double point2YCoordinate,double point3XCoordinate,double
point3YCoordinate){
point1= new Point(point1XCoordinate,point1YCoordinate);
point2= new Point(point2XCoordinate,point2YCoordinate);
point3= new Point(point3XCoordinate,point3YCoordinate);
}
public Triangle(Point point1, Point point2, Point point3){
this.point1= point1;
this.point2= point2;
this.point3= point3;
}
class Tester {
public static void main(String[] args) {
Triangle triangle1 = new Triangle();
Triangle triangle2 = new Triangle(1, 2, 6, 5, 5, 1);
}
}
-------------------
---------------------
DAY 3
------------------------
*METHOD OVERRIDING- TRYOUT*
----
1. class Tester {
class Customer {
@Override
public double payBill(double totalPrice) {
System.out.println("Final bill for the regular customer is calculated here");
double priceAfterDiscount = totalPrice * (1 - (5f / 100));
return priceAfterDiscount;
}
-------------
2. class Tester {
public static void main(String args[]) {
Bank bank;
bank = new ABCBank();
System.out.println("ABCBank - Rate of Interest(%): "
+ bank.getRateOfInterest());
bank = new DEFBank();
System.out.println("DEFBank - Rate of Interest(%): "
+ bank.getRateOfInterest());
bank = new GHIBank();
System.out.println("GHIBank - Rate of Interest(%): "
+ bank.getRateOfInterest());
}
}
class Bank {
public float getRateOfInterest() {
return 0;
}
// remove the access specifier and observe the output
}
displayEmployeeDetails(employee);
displayEmployeeDetails(manager);
displayEmployeeDetails(eduEmployee);
displayEmployeeDetails(managerEdu);
}
// Employee reference can accept its object and any of the child object
public static void displayEmployeeDetails(Employee employee) {
employee.displayDetails(); // displayDetails invoked will be based on the object
received
}
}
class Employee {
String name = "James Anthony";
class Tester {
processPayment(user, 70);
processPayment(premiumUser, 150);
processPayment(premiumUser, 80);
processPayment(premiumUser, 120);
--------------------------
*EQUAL OBJECTS TRYOUT*
---------
class Food {
class Tester {
if (foodOne == foodTwo) {
System.out.println("The food objects are same!");
} else {
System.out.println("The food objects are different!");
}
}
}
---------------
*EQUALS TRYOUT*
class Food {
class Tester {
if (foodOne.equals(foodTwo)) {
System.out.println("foodOne and foodTwo are same!");
} else {
System.out.println("foodOne and foodTwo are different!");
}
// equals method of Object class overridden for comparing two Food objects
// based on foodName and foodType
@Override
public boolean equals(Object obj) {
Food otherFood = (Food) obj;
if (this.foodName.equals(otherFood.foodName)) {
if (this.foodType.equals(otherFood.foodType))
return true;
}
return false;
}
class Tester {
if (foodOne.equals(foodTwo)) {
System.out.println("foodOne and foodTwo are same!");
} else {
System.out.println("foodOne and foodTwo are different!");
}
if (foodOne.equals(foodThree)) {
System.out.println("foodOne and foodThree are same!");
} else {
System.out.println("foodOne and foodThree are different!");
}
}
}
-------------------------
*to-STRING TRYOUT*
class Food {
// equals method of Object class overridden for comparing two Food objects
// based on foodName and foodType
@Override
public boolean equals(Object obj) {
Food otherFood = (Food) obj;
if (this.foodName.equals(otherFood.foodName)) {
if (this.foodType.equals(otherFood.foodType))
return true;
}
return false;
}
class Tester {
// Comment the toString() in the Food class and execute the code
System.out.println(foodOne);
}
}
--------------------------------
------------
*WRAPPER CLASSES TRYOUT*
-----
class Tester {
public Demo() {
num = 10;
}
class Tester {
public static void main(String args[]) {
Demo demo = new Demo();
demo.displayNumber();
}
}
-------------------------------
*FINAL EXERCISE 1*
class Student{
private final int STIPEND=100;
private int studentId;
private int aggregateMarks;
public int getStudentId() {
return studentId;
}
public void setStudentId(int studentId) {
this.studentId = studentId;
}
public int getAggregateMarks() {
return aggregateMarks;
}
public void setAggregateMarks(int aggregateMarks) {
this.aggregateMarks = aggregateMarks;
}
public int getSTIPEND() {
return STIPEND;
}
public double calculateTotalStipend(){
int bonus=0;
if(this.aggregateMarks>=85 && this.aggregateMarks<90)
{
bonus=10;
}
else if(this.aggregateMarks>=90 && this.aggregateMarks<95){
bonus=15;
}
else if(this.aggregateMarks>=95 && this.aggregateMarks<=100){
bonus=20;
}
int good= (int)(bonus+ this.STIPEND);
return good;
}
}
class Tester {
totalStipend = student2.calculateTotalStipend();
System.out.println("The final stipend of " + student2.getStudentId()+" is $" +
totalStipend);
}
}
-------
------------------
*DAY 4*
-----------------
*ABSTRACT CLASS AND METHODS-TRYOUT*
abstract class GrandParent {
abstract void display();
}
abstract class Parent extends GrandParent { // Can we remove the abstract keyword from
here?
final void displayInParent() {
System.out.println("In Parent");
}
}
class Tester {
public static void main(String[] args) {
new GrandChild().display();
}
}
------------------------
*INSTANCE OF- TRYOUT*
abstract class Employee{
private String employeeId;
private String name;
private static int counter;
static{
counter=101;
}
@Override
public void calculateSalary(){
System.out.println("Calculating salary of PermanentEmployee");
}
@Override
public void calculateSalary(){
System.out.println("Calculating salary of ContractEmployee");
}
class SalarySlipGenerator{
public void displaySalarySlip(Employee employee){
employee.calculateSalary();
//Checking if employee is an instance of PermanentEmployee
if(employee instanceof PermanentEmployee){
//Type casting parent class reference to child class for accessing child class method
PermanentEmployee permanentEmployee=(PermanentEmployee)employee;
permanentEmployee.calculateBonus();
}
}
}
class Tester{
public static void main(String[] args) {
PermanentEmployee permanentEmployee=new PermanentEmployee("Angie");
System.out.println("Details of permanent employee");
System.out.println("Employee Id: "+permanentEmployee.getEmployeeId());
System.out.println("Name: "+permanentEmployee.getName());
System.out.println();
System.out.println();
System.out.println();
}
public void generateResult() {
int []testScores=super.getTestScores();
int total = 0;
for(int i=0;i<testScores.length;i++) {
total+=testScores[i];
}
double average=total/testScores.length;
if(average>=70) {
super.setTestResult("Pass");
}else if(average<70) {
super.setTestResult("Fail");
}
}
class Tester {
System.out.println();
graduateStudent.generateResult();
class Tester {
public static void main(String[] args) {
DemoTwo obj = new DemoClassOne();
obj.display();
}
}
-----------------
*INTERFACE EXERCISE 1*
interface Tax{
double calculateTax(double price);
}
System.out.println("Seller Details\n*******");
Seller seller = new Seller("Middle east");
System.out.println("Tax to be paid by the seller: " +
Math.round(seller.calculateTax(100)*100)/100.0);
System.out.println("Tax percentage: "+seller.getTaxPercentage());
}
}
-----------------------------
--------
*ASSIGNMENTS*
---
1. METHOD OVERRIDING 1
class Faculty{
//Implement your code here
private String name;
private float basicSalary;
private float bonusPercentage;
private float carAllowancePercentage;
public Faculty(String name,float basicSalary){
this.name= name;
this.basicSalary= basicSalary;
this.bonusPercentage=4f;
this.carAllowancePercentage= 2.5f;
}
public double calculateSalary(){
double facultySalary=
this.getBasicSalary()*(1+(this.getBonusPercentage()/100)+(this.getCarAllowancePercentage()/1
00));
this.setBasicSalary((float) facultySalary);
return facultySalary;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getBasicSalary() {
return basicSalary;
}
public void setBasicSalary(float basicSalary) {
this.basicSalary = basicSalary;
}
public float getBonusPercentage() {
return bonusPercentage;
}
public void setBonusPercentage(float bonusPercentage) {
this.bonusPercentage = bonusPercentage;
}
public float getCarAllowancePercentage() {
return carAllowancePercentage;
}
public void setCarAllowancePercentage(float carAllowancePercentage) {
this.carAllowancePercentage = carAllowancePercentage;
}
class Tester {
public static void main(String[] args) {
System.out.println("Teacher Details\n***************");
System.out.println("Name: "+teacher.getName());
System.out.println("Qualification: "+teacher.getQualification());
System.out.println("Total salary: $" +
Math.round(teacher.calculateSalary()*100)/100.0);
System.out.println();
}
}
--------------------
2. METHOD OVERRDING-2
class Event{
//Implement your code here
private String eventName;
private String participantName;
private double registrationFee;
public Event(String eventName, String participantName){
this.eventName= eventName;
this.participantName= participantName;
}
public void registerEvent(){
if(this.getEventName().equals("Singing")){
this.setRegistrationFee(8);
}
else if(this.getEventName().equals("Dancing")){
this.setRegistrationFee(10);
}
else if(this.getEventName().equals("DigitalArt")){
this.setRegistrationFee(12);
}
else if(this.getEventName().equals("Acting")){
this.setRegistrationFee(15);
}
else{
this.setRegistrationFee(0);
}
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getParticipantName() {
return participantName;
}
public void setParticipantName(String participantName) {
this.participantName = participantName;
}
public double getRegistrationFee() {
return registrationFee;
}
public void setRegistrationFee(double registrationFee) {
this.registrationFee = registrationFee;
}
}
class SoloEvent extends Event{
//Implement your code here
private int participantNo;
public SoloEvent(String eventName, String participantName, int participantNo){
super(eventName, participantName);
this.participantNo= participantNo;
}
@Override
public void registerEvent(){
super.registerEvent();
}
public int getParticipantNo() {
return participantNo;
}
public void setParticipantNo(int participantNo) {
this.participantNo = participantNo;
}
}
}
public int getNoOfParticipants() {
return noOfParticipants;
}
public void setNoOfParticipants(int noOfParticipants) {
this.noOfParticipants = noOfParticipants;
}
public int getTeamNo() {
return teamNo;
}
public void setTeamNo(int teamNo) {
this.teamNo = teamNo;
}
class Tester {
} else {
System.out.println("Please enter a valid event");
}
System.out.println();
TeamEvent teamEvent = new TeamEvent("Acting", "Serena", 5, 1);
teamEvent.registerEvent();
if (teamEvent.getRegistrationFee() != 0) {
System.out.println("Thank You " + teamEvent.getParticipantName()
+ " for your participation! Your registration fee is $" +
teamEvent.getRegistrationFee());
System.out.println("Your team number is " + teamEvent.getTeamNo());
} else {
System.out.println("Please enter a valid event");
}
}
}
--------------
3. FINAL 1
class Circle{
private final double PI=3.14;
private double diameter;
private double circumference;
private double area;
public double getDiameter() {
return diameter;
}
public void setDiameter(double diameter) {
this.diameter = diameter;
}
public double getCircumference() {
return circumference;
}
public void setCircumference(double circumference) {
this.circumference = circumference;
}
public double getArea() {
return area;
}
public void setArea(double area) {
this.area = area;
}
public double getPI() {
return PI;
}
//Create more objects of Circle class and add to the array given below for testing your code
Circle[] circles = {circle1, circle2};
circle.calculateCircumference();
circle.calculateArea();
}
----------------
4. ABSTRACT 1
class AbstractAssignment {
}
---------------
5. INTERFACE 1
interface Testable{
boolean testCompatibility();
}
class Mobile{
private String name;
private String brand;
private String operatingSystemName;
private String operatingSystemVersion;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getOperatingSystemName() {
return operatingSystemName;
}
public void setOperatingSystemName(String operatingSystemName) {
this.operatingSystemName = operatingSystemName;
}
public String getOperatingSystemVersion() {
return operatingSystemVersion;
}
public void setOperatingSystemVersion(String operatingSystemVersion) {
this.operatingSystemVersion = operatingSystemVersion;
}
public Mobile(String name,String brand,String operatingSystemName,String
operatingSystemVersion) {
this.name=name;
this.brand=brand;
this.operatingSystemName=operatingSystemName;
this.operatingSystemVersion=operatingSystemVersion;
}
}
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("1.1
"))){
return true;
}
else
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("1.2"))){
return true;
}
else
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("1.3"))){
return true;
}
else
if(this.networkGeneration.equals("4G")&&(this.getOperatingSystemVersion().equals("1.2"))){
return true;
}
else
if(this.networkGeneration.equals("4G")&&(this.getOperatingSystemVersion().equals("1.3"))){
return true;
}
else
if(this.networkGeneration.equals("5G")&&(this.getOperatingSystemVersion().equals("1.3"))){
return true;
}
else {
return false;
}
}
else if(this.getOperatingSystemName().equals("Gara")) {
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("EX
RT.1"))){
return true;
}
else
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("EXRT.2")))
{
return true;
}
else
if(this.networkGeneration.equals("3G")&&(this.getOperatingSystemVersion().equals("EXRU.1"))
){
return true;
}
else
if(this.networkGeneration.equals("4G")&&(this.getOperatingSystemVersion().equals("EXRT.2")))
{
return true;
}
else
if(this.networkGeneration.equals("4G")&&(this.getOperatingSystemVersion().equals("EXRU.1"))
){
return true;
}
else
if(this.networkGeneration.equals("5G")&&(this.getOperatingSystemVersion().equals("EXRU.1"))
){
return true;
}
else {
return false;
}
}
else
return false;
}
}
class InterfaceAssignment {
}
--------------------------------------