Java Et1
Java Et1
WORKSHEET 1
1. Aim: Being a student means that you spend a lot of the time reading
which may include your primary (SE text book/ some of the DVDs
from your online lecture) list create reviews and possibly some
random novels of your own interest. you make the unusual decision
to use software to manage your book half time you have a technical
mindset you own personal book half can be implemented by
employing proper oops ideas to brainstorm and write java code
2. Source Code:
import java.util.Scanner;
class library
{
String Name;
int publishing_year;
}
class text_book extends library
{
String Writer;
Scanner sc=new Scanner(System.in);
public void set()
{
System.out.print("Enter the name of the book :");
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Name=sc.next();
System.out.print("Enter the name of Writer of the book :");
Writer = sc.next();
System.out.print("Enter the publishing_year of the book :");
publishing_year=sc.nextInt();
}
switch(choice)
{
case 1:
{
TB.get();
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
break;
}
case 2:
{
D.get();
break;
}
case 3:
{
N.get();
break;
}
default:
{
System.out.println("Wrong choice entered please try
again...!");
}
}
}
}
3. Screenshot of Outputs:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
4. Learning Outcomes
(i) Classes
(ii)Inheritance
(iii)Switch case
(iv)Scanner-Taking input from user