Beruflich Dokumente
Kultur Dokumente
LAB #01
TASK #01:-
Description
Write a program to input a table and it's limit by the user and print it's table using for llop for 50
times.
package tablee;
/**
* @author satti
*/
import java.util.Scanner;
/**
*/
int n;
n=in.nextInt();
int a;
a=n*i;
System.out.println(n+"*"+i+"="+a);
}
LAB REPORT
}
LAB REPORT
LAB #02
TASK #01:-
Description
Create a class calculator with two variables a constructor with no parameter and two functions for
add and multiply. Create class testapp with a main function and create object of calculator class to
call function.
package calculator;
/**
* @author satti
*/
import java.util.Scanner;
class calculat{
int a,b;
int sum;
int product;
calculat () {
void sum () {
sum=a+b;
System.out.println("sum of number="+sum);
void product () {
product=a*b;
System.out.println("product of number="+product);
}
LAB REPORT
/**
*/
obj.a= in.nextInt();
obj.b= in.nextInt();
obj.sum();
obj.product();
}
LAB REPORT
LAB #03
TASK #01
Description
Create a class calculator with two variables a constructor with no parameter and two overloaded
functions for add and multiply. Also call functions using math class Create class testapp with a
main function and create object of calculator class to call function.
package OveloadConstructor;
/**
* @author satti
*/
import java.util.Scanner;
class calculat{
int a,b;
int sum;
int product;
calculat () {
AB=a;
CD=b;
}
LAB REPORT
void sum () {
sum=a+b;
System.out.println("sum of number="+sum);
void product () {
product=a*b;
System.out.println("product of number="+product);
/**
*/
obj.a= in.nextInt();
obj.b= in.nextInt();
obj.sum();
obj.product();
}
LAB REPORT
LAB REPORT
LAB #04
TASK #01
/*
*/
package teachers;
/**
* @author satti
*/class Teacher{
String designation;
String college;
void work () {
System.out.println("he is a teacher");
/**
*/
obj.work();
System.out.println(obj.designation);
System.out.println(obj.college);