Learn Advanced Java coaching from the Best Tutors
Search in
Answered on 01/09/2017 Learn Advanced Java coaching
Surabhi Technologies
Lesson Posted on 24/06/2017 Learn Advanced Java coaching
EFFECTIVE TASKS & RESPONSIBILITIES DELEGATION
Rohit Raj Verma
I have 8+ years of experience in the area of web development and application programming. I have worked...
Do you feel your business relies too much on you?
In working with business owners, there are a couple of tools we introduce to productively shift the workload and responsibility across the organization. If you use just one of these tools, we guarantee you will see a noticeable improvement in your current working situation.
First, document what you do!
The first tool or practice we typically prescribe is to ask you to document everything you do for 10 business days. In other words, we provide a form you fill in that indicates when you begin an activity, when you end it, what the activity is and what “category” it fits into. In TouchStone, go to the “Task Delegation & Work Management” inside of the “Guiding” the Business Process Library.
Before you start, be sure to select categories you’d like to track. For instance, if you suspect you’re spending too much time on administrative work, set up an Administrative category. Alternately, you might like to track the amount of time you devote to Sales, Marketing, Operations or Strategic Work.
I used this tool many years ago when a partner of mine suggested I might be spending too much time acting as the board president of my son’s private school and not enough time on our business. When I tracked my time, using Company Work as one category and School Work as another, I was astonished to find that the amount of time I worked as the school’s board president almost constituted a second job. I made adjustments and had more time to devote to my business.
Next, ask if it can be delegated!
Another worksheet we use asks you to document every activity and then note whether that activity could be delegated if you had:
In TouchStone, go to the “Task Delegation & Work Management” inside of the “Guiding” the Business Process Library.
Pretty quickly you’ll find activities that you can delegate to others in your organization with low risk to your company and your customers.
Then, when you take the practice a step further, you may find other areas that you thought you had to do that could be conducted by another member of your team. For example, several years ago I worked with the head of an insurance agency who insisted that “sorting the mail” could not be delegated. I was surprised to think that this leader of a fairly large agency took the time to go to the post office box, get the mail and sort through it every day.
What we discovered was that sorting the mail wasn’t the issue but that he was reluctant to let go of addressing some of the important client communications that came through the mail, and rightly so. So, we developed a simple system that guided his office manager in getting the mail, throwing out junk mail, delivering client communications to the business owner and delivering accounts payables and receivables to the head of finance. It sounds so simple, but until he was able to think through what he was doing, examine the mail “process”, and discover how much time each week he spent processing the mail, he was unwilling to delegate that task to another employee.
Try it for yourself
Sorting the mail might sound like an obvious task to delegate, but you’d be surprised to see what activities business owners and top management hold on to, including you. As you work through this exercise – and even if you only do it for a day or two – you’ll experience many insights that free you up to re-distribute work and have more time to devote to growing and developing your business.
read lessAnswered on 11/06/2017 Learn Advanced Java coaching
Juned Kazi
Diploma/Degree in Mechanical Engineering Tutions
Learn Advanced Java coaching from the Best Tutors
Lesson Posted on 30/05/2017 Learn Advanced Java coaching
Paras Chawla
Working as a Senior Software Developer(R and D) in the following technologies. 1. Java 2. J2EE/J2ME 3....
Snippet of an Immutable Class:
package com.stringhr;
/*Declare the class as 'final'. This would prevent any other class from extending it
and hence from overriding any method from it which could modify instance variable values.*/
final class ImmutableClass {
// private variables, thus invisible beyond current class...
private final int salary;
private final String name;
// private constructor, so that child class object can't be instantiated...
private ImmutableClass(int salary, String name) {
this.salary = salary;
this.name = name;
}
// Only Getters, no Setter method so that no field can be modified
public int getSalary() {
return salary;
}
public String getName() {
return name;
}
}
Why is String immutable in Java?
The string is immutable for several reasons, here is a summary:
String a=“Paras”;
String b=“Paras”
We all know that a and b points to the same Object in a heap if a changed to ”Chawla”, b will still point to “Paras” which is not possible if String weren’t immutable.
String a="Paras";
String b=a;
System.out.println(a==b);
a="Chawla";
System.out.println(a +b);
Output:
true
If I have a class with all static members is it immutable?
If your class has only static members, then objects of this class are immutable, because you cannot change the state of that object (you probably cannot create it either).
read lessLesson Posted on 29/05/2017 Learn Advanced Java coaching
Paras Chawla
Working as a Senior Software Developer(R and D) in the following technologies. 1. Java 2. J2EE/J2ME 3....
Algorithm - Fractional Knapsack
import java.util.Scanner;
public class Knapsack01 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(); // 1
int W = scan.nextInt(); // 1000
float value[] = new float[n]; // 500
float weight[] = new float[n]; // 30
float ratio[] = new float[n];
for (int i = 0; i < n; i++) {
value[i] = scan.nextInt();
weight[i] = scan.nextInt();
ratio[i] = value[i] / weight[i];
}
float totalValue = knapSack01(W, value, weight, ratio, n);
System.out.println(totalValue);
}
public static float knapSack01(float W, float[] value, floatweight[], float ratio[],
int n) {
float V = 0;
while (n>0 && W!=0) {
int mI = maxIndex(n, ratio);
float w=min(weight[mI],W);
// W=40,weight[2]=30 // W=10,weight[0]=20;
W = W - w;
V = V + w*ratio[mI];
weight[mI]=weight[mI]-w;
ratio[mI] = 0;
n--;
}
return V;
}
public static float min(float a,float b){
return a>b?b:a;
}
public static int maxIndex(int n, float ratio[]) {
float largest = Integer.MIN_VALUE;
int lastIndex = 0;
for (int i = 0; i < n; i++) {
if (ratio[i] > largest) {
largest = ratio[i];
lastIndex = i;
}
}
return lastIndex;
}
}
Output:
Input: 3 50
60 20 100
50 120 30
Output: 180.0000
read lessLesson Posted on 29/05/2017 Learn Advanced Java coaching
Simple Algorithms - Fibonacci, Finding GCD & Finding LCM.
Paras Chawla
Working as a Senior Software Developer(R and D) in the following technologies. 1. Java 2. J2EE/J2ME 3....
import java.util.Scanner;
//0,1,1,2,3,5,8,13,21,34...
//fun(n)=fun(n-1)+fun(n-2) where n>=2
/*fib(9)=fib(8)+fib(7)
=fib(7)+fib(6)+fib(6)+fib(5)
=fib(6)+fib(5)+fib(5)+fib(4)+fib(5)+fib(4)+fib(4)+fib(3)
*/
public class FibonacciNumberFast {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long fno=fibonacciNumber(n);
System.out.println(fno);
}
public static long fibonacciNumber(int n){
int array[]= new int[n+1];
array[0]=0;
if(n==0)
return array[0];
array[1]=1;
for(int i=2;i<=n;i++)
array[i]=array[i-1]+array[i-2];
return array[n];
}
}
Algorithm 2– Finding GCD of a number
1) GCD using Recursion
2) GCD using naïve approach
import java.util.Scanner;
// Largest number which divides both a and b
public class GCDNaive {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long a = scanner.nextLong();
long b = scanner.nextLong();
//long gcd = gcd(a, b);
//System.out.println("Result from GCD Naive "+gcd);
gcdFast(a, b);
}
static void gcdFast(long a, long b) {
if (b == 0) {
System.out.println(a);
System.exit(0);
}
long rem=a%b;
gcdFast(b, rem);
}
/* static long gcd(long a, long b) {
long best = 0;
for (long i = 1; i <= a + b; i++) {
if ((a%i ==0) && (b%i== 0))
best = i;
}
return best;
}
*/}
Algorithm 3 – Finding LCM of a number
import java.util.Scanner;
// GCD(a,b)*LCM(a,b)=a*b
public class LCM {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long a = scanner.nextLong(); // 8
long b = scanner.nextLong(); // 6
// long c = gcd(a, b);
// System.out.println("GCD is" + c);
long c = gcdFast(a, b);
long d = (a * b) / c;
System.out.println(d);
}
static long gcdFast(long a, long b) {
if (b == 0) {
return a;
}
long rem = a % b;
long c=gcdFast(b, rem);
return c;
}
/* static long gcd(long a, long b) {
long best = 0;
for (long i = 1; i <= a + b; i++) {
if ((a % i == 0) && (b % i == 0))
best = i;
}
return best;
}*/
}
read lessLearn Advanced Java coaching from the Best Tutors
Lesson Posted on 29/05/2017 Learn Advanced Java coaching
Paras Chawla
Working as a Senior Software Developer(R and D) in the following technologies. 1. Java 2. J2EE/J2ME 3....
Ø Prototype pattern refers to creating duplicate object while keeping performance in mind.
Ø This pattern involves implementing a prototype interface which tells to create a clone of the current object.
Ø This pattern is used when creation of object directly is costly. For example, an object is to be created after a costly database operation.
Ø We can cache the object, returns its clone on next request and update the database as and when needed thus reducing database calls.
Prototype DP involves cloning of object and thus object needs to:
Ø Implement Cloneable interface
Ø Override clone() of Object class
public abstract class Payment implements Cloneable {
protected double amount;
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public abstract void makePayment();
public Object clone() {
Object clone = null;
try {
clone = super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return clone;
}
}
public class CreditCard extends Payment {
public void makePayment() {
System.out.println("Payment of "+amount+ " by Credit Card");
}
}
public class CashPayment extends Payment {
public void makePayment() {
System.out.println("Payment of "+amount+" by Cash");
}
}
public class PaymentCache {
private Map<String, Payment> map = new HashMap();
public Payment getPayment(String key) {
Payment payment = map.get(key);
return (Payment) payment.clone();
}
// Map of Objects which are frequently used...
// Original objects are acting as template objects...
public void loadCache() {
CashPayment cash = new CashPayment();
cash.setAmount(2000);
map.put("cash", cash);
CreditCard credit = new CreditCard();
credit.setAmount(4000);
map.put("credit", credit);
}
}
public class Client {
public static void main(String[] args) {
PaymentCache cache= new PaymentCache();
cache.loadCache();
Payment payment=cache.getPayment("cash");
payment.makePayment();
Payment payment1=cache.getPayment("credit");
payment1.makePayment();
}
}
Output:
Payment of 2000.0 by Cash
Payment of 4000.0 by Credit Card
Application:
Session replication from one server to another server.
Generating the GUI having many numbers of similar controls.
Advantage of Prototype Pattern:
It reduces the need of subclassing.
It hides complexities of creating objects.
The clients can get new objects without knowing which type of object it will be.
It lets you add or remove objects at runtime.
Usage of Prototype Pattern:
When the classes are instantiated at runtime.
When the cost of creating an object is expensive or complicated.
When you want to keep the number of classes in an application minimum.
When the client application needs to be unaware of object creation and representation.
read less
Answered on 14/06/2017 Learn Advanced Java coaching
Ranjan K.
Tutor
Answered on 16/05/2017 Learn Advanced Java coaching
Prashanth Kannadaguli
BEST Technical Trainer & Freelancer
Learn Advanced Java coaching from the Best Tutors
Answered on 01/05/2017 Learn Advanced Java coaching
Chetana t.
Tutor
UrbanPro.com helps you to connect with the best Advanced Java coaching in India. Post Your Requirement today and get connected.
Ask a Question
The best tutors for Advanced Java coaching Classes are on UrbanPro
The best Tutors for Advanced Java coaching Classes are on UrbanPro