Assignment 01
Assignment 01
These variables are created when an These variables are created when a block,
object is instantiated and are method or constructor is started and the
accessible to all constructors, methods, variable will be destroyed once it exits the
or blocks in class. block, method, or constructor.
These variables are destroyed when These variables are destroyed when the
the object is destroyed. constructor or method is exited.
It can be accessed throughout the Its access is limited to the method in which it
class. is declared.
They are used to reserving memory for They are used to decreasing dependencies
data that the class needs and that too for between components I.e., the complexity of
the lifetime of the object. code is decreased.
It includes access modifiers such as It does not include any access modifiers such
private, public, protected, etc. as private, public, protected, etc.
2. Java Math Class in Java contains certain methods to perform different numeric operations, for
instance, exponential, square root, logarithmic, trigonometric functions.
To perform different numeric calculations in Java, math class has provided several methods
which you will study further.
Some of the methods are min(), max(), avg(), sin(), cos() etc.
3.
/**
*
*/
package Assignment1_E2046333;
import java.util.Scanner;
/**
* @author Acer
*
*/
public class Assignment1_E2046333 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String name;
String EmpID;
int jobtype;
int workex;
int rate;
int workinghr;
int overtime;
int monthlySal;
if(jobtype==1){
System.out.println("Full-time Employee company
experience");
System.out.println("1.Less than 1 year");
System.out.println("2.1-2 years");
System.out.println("3.2-3 years");
System.out.println("4.More than 3 years");
System.out.println("Enter your option: ");
workex=scan.nextInt();
if (workex==1) {
System.out.println("Your name is: "+name);
System.out.println("Your Employee ID is:
"+EmpID);
System.out.println("Your salary is: Rs.
30,000");
}else if(workex==2) {
System.out.println("Your name is: "+name);
System.out.println("Your Employee ID is:
"+EmpID);
System.out.println("Your salary is: Rs.
45,000");
}else if(workex==3) {
System.out.println("Your name is: "+name);
System.out.println("Your Employee ID is:
"+EmpID);
System.out.println("Your salary is: Rs.
60,000");
}else if(workex==4) {
System.out.println("Your name is: "+name);
System.out.println("Your Employee ID is:
"+EmpID);
System.out.println("Your salary is: Rs.
70,000");
}
else if (jobtype==2) {