Professional Documents
Culture Documents
Experiment 2
Experiment 2
2
Problem No.1
class Product {
int ID;
String name;
float price;
ID = id;
name = n;
price = p;
void display() {
class Records {
p1.display();
p2.display();
Output:
Id of Product is 10
Id of Product is 11
Problem No.2
class Mobile {
String Company_name;
int Screen_size;
Company_name = n;
Screen_size = ss;
void display() {
Company_name);
class Records {
m.insertRecord("Iphone", 11);
m.display();
Output:
Name of Company is Iphone
class Rectangle {
int length;
int width;
double area;
void input() {
length = l.nextInt();
width =w.nextInt();
void output() {
class rectangle {
r.input();
r.output();
Output:
Enter the length
Problem No.4
import java.util.*;
class Employee {
int emp_id;
String name;
int Basic_salary;
void input() {
emp_id = empid.nextInt();
name = n.nextLine();
Basic_salary = BS.nextInt();
void output() {
class Total_salary {
E1.input();
E1.output();
E2.input();
E2.output();
Output:
Enter Employe id 101
Ayush Patil
Enter Employe id
102
50000
Problem No.5
import java.util.*;
class Student {
int Roll_no;
String name;
double Percantage;
void input() {
Roll_no = rn.nextInt();
name = n.nextLine();
Physics = p.nextInt();
Chemistry = p.nextInt();
void output() {
class Percantage {
s.input();
s.output();
Output:
Enter Roll no. 33
85
80