My_Handwritten_Questions_To_Practtice_Coding
My_Handwritten_Questions_To_Practtice_Coding
//(b) Create a method "callMe" which will print all the even numbers between 1
to 100.
//(c) Create a method "testMe" which will print sum up all the odd numbers
between 1 to 100.
public void testMe(){
Integer sum = 0;
for (Integer i=1; i<= 100; i++){
Integer rem = Math.mod(i,2);
if (rem == 1){
sum = sum+i;
}
}
System.debug('Sum:' +sum);
Sum = sum+1;
System.debug('Sum:' +sum);
}
//(d) Create a method "calculate" which will take city and place as parameters
and print them.
public void calculate(String city, String place){
System.debug('City:' +city);
System.debug('Place:' +place);
}
//(e) create a method "callMe" with name and dob as parameters and print them.
public void callMe3(String name, Date dob){
System.debug('Name:' +name);
System.debug('Date:' +dob);
}
/* (f) Create a method "invoke" which will take age and exp as input parameters
and calculate salary and bonus
if age is above 40 and exp is above 10
salary is 50k and bonus is 30k
else salary is 30k and bonus is 5k*/
//(h) Create a method "invoke" which returns salary 1000.00 and print this
value.
public Decimal invoke(){
Decimal salary = 1000.00;
return salary;
}
//(i) create a method "show" which will return name and print this value.
public String show(){
String name = 'Shairy';
return name;
}
//(j) cerate a method "invoke1" which will return dob and print this value.
public Date invoke1(){
Date dob = Date.newInstance(1999,10,18);
return dob;
}
// (k) create a method "callMe1" which will return age and print this value.
public Integer callMe1(){
Integer age = 23;
return age;
}
/*(l) create a method "calculate" which will take age and exp as parameters
and calculate salary bonus and return the totalAmount
//(m) Create a method "calculate" which will take internal marks and external
marks and return total.
/*(n) create a method "calculate" which will take internal marks and external marks
and
return true if total is grater then or equals 40,
false if less then 40.*/