Sie sind auf Seite 1von 9

LAB REPORT

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;

public class Tablee {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

int n;

System.out.println("enter number ");

Scanner in=new Scanner(System.in);

n=in.nextInt();

for (int i=1; i<=50; i++)

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

public class Calculator {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

Scanner in=new Scanner (System.in);

calculat obj= new calculat ();

System.out.println("enter first number");

obj.a= in.nextInt();

System.out.println("enter second number");

obj.b= in.nextInt();

obj.sum();

obj.product();

// TODO code application logic here

}
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 () {

calculat(int AB, int CD) {

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);

public class OveloadConstructor {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

Scanner in=new Scanner (System.in);

calculat obj= new calculat ();

System.out.println("enter first number");

obj.a= in.nextInt();

System.out.println("enter second number");

obj.b= in.nextInt();

obj.sum();

obj.product();

// TODO code application logic here

}
LAB REPORT
LAB REPORT

LAB #04
TASK #01
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package teachers;

/**

* @author satti

*/class Teacher{

String designation;

String college;

void work () {

System.out.println("he is a teacher");

class physicsteacher extends Teacher {

public class Teachers {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

physicsteacher obj=new physicsteacher ();


LAB REPORT

obj.designation="he is a physics teacher";

obj.college="he teaches in NUML";

obj.work();

System.out.println(obj.designation);

System.out.println(obj.college);

Das könnte Ihnen auch gefallen