This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
The document contains code examples demonstrating Java programming concepts like:
1) Printing output to the console using System.out.println();
2) Declaring and initializing variables of different primitive data types;
3) Using the Scanner class to take user input;
4) Demonstrating inheritance between classes through extending superclasses; and
5) Overloading constructors.
The document discusses several key concepts in object-oriented programming including encapsulation, inheritance, polymorphism, abstraction, and encapsulation. It provides examples of each concept and code snippets demonstrating their usage. Multiple inheritance, single inheritance, hierarchical inheritance, abstract classes, interfaces, and encapsulation are defined and code examples are given to predict the output of programs utilizing these object-oriented programming principles.
This document contains a Java programming lab manual provided by Prof. K. Adisesha for a 5th semester BCA course. It includes 11 programs demonstrating Java concepts like classes, objects, inheritance, polymorphism, wrappers, strings, arrays, and more. For each program there is the Java code, sample output, and a brief description. Contact details for Prof. Adisesha are provided at the beginning for any feedback.
The document contains code snippets demonstrating various Java programming concepts:
1. It includes code examples to demonstrate bitwise operators, arithmetic operators, conditional operators, constructor overloading, and method overloading in Java.
2. Further code examples showcase prefix/postfix increment/decrement operators, relational operators, the super keyword, and pattern printing in Java.
3. The document also contains code for applets demonstrating buttons, checkboxes, choice lists, labels, lists, banner movement, graphics, and text fields.
4. Additional code shows examples of multithreading, the Scanner class, and text fields and buttons in Swing.
The document provides a collection of code snippets that implement different
Quest 1 define a class batsman with the following specificationsrajkumari873
The document defines several Java classes with private and public members to model different real-world entities. This includes classes for batsmen (with code, name, stats, and average calculation), tests (with code, description, candidates, and center calculation), flights (with number, destination, distance, and fuel calculation), books (with number, title, price, purchase calculation), reports (with admission, name, marks, and average calculation), students (with admission, name, subjects, and total calculation), and telephone bills (with readings, calls, name, charges and calculation). Public member functions allow entering and displaying data, while private functions perform calculations.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
This document contains a Java practical file belonging to Rachit Gupta, an MCA student. It consists of 16 programs of varying complexity written in Java, along with the output of each program. The programs cover topics such as calculating the square root of a number, finding the perimeter of a rectangle, calculating percentage of marks, and generating an electric bill based on units consumed. The file is a submission of Rachit Gupta's Java practical assignments for his 4th semester MCA course at the University of Jammu.
The document contains code examples demonstrating Java programming concepts like:
1) Printing output to the console using System.out.println();
2) Declaring and initializing variables of different primitive data types;
3) Using the Scanner class to take user input;
4) Demonstrating inheritance between classes through extending superclasses; and
5) Overloading constructors.
The document discusses several key concepts in object-oriented programming including encapsulation, inheritance, polymorphism, abstraction, and encapsulation. It provides examples of each concept and code snippets demonstrating their usage. Multiple inheritance, single inheritance, hierarchical inheritance, abstract classes, interfaces, and encapsulation are defined and code examples are given to predict the output of programs utilizing these object-oriented programming principles.
This document contains a Java programming lab manual provided by Prof. K. Adisesha for a 5th semester BCA course. It includes 11 programs demonstrating Java concepts like classes, objects, inheritance, polymorphism, wrappers, strings, arrays, and more. For each program there is the Java code, sample output, and a brief description. Contact details for Prof. Adisesha are provided at the beginning for any feedback.
The document contains code snippets demonstrating various Java programming concepts:
1. It includes code examples to demonstrate bitwise operators, arithmetic operators, conditional operators, constructor overloading, and method overloading in Java.
2. Further code examples showcase prefix/postfix increment/decrement operators, relational operators, the super keyword, and pattern printing in Java.
3. The document also contains code for applets demonstrating buttons, checkboxes, choice lists, labels, lists, banner movement, graphics, and text fields.
4. Additional code shows examples of multithreading, the Scanner class, and text fields and buttons in Swing.
The document provides a collection of code snippets that implement different
Quest 1 define a class batsman with the following specificationsrajkumari873
The document defines several Java classes with private and public members to model different real-world entities. This includes classes for batsmen (with code, name, stats, and average calculation), tests (with code, description, candidates, and center calculation), flights (with number, destination, distance, and fuel calculation), books (with number, title, price, purchase calculation), reports (with admission, name, marks, and average calculation), students (with admission, name, subjects, and total calculation), and telephone bills (with readings, calls, name, charges and calculation). Public member functions allow entering and displaying data, while private functions perform calculations.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
The document describes Java programs to demonstrate various concepts:
1. Generating a WiFi password based on user input of name, city, age, and gender.
2. Finding the character with the second highest frequency in a string.
3. Finding the longest subsequence of the same character in a string.
4. Generating a WiFi key based on user input of name, city, age, and gender.
5. Deleting non-empty text files from a specified folder.
6. Checking if a character appears twice in two strings and returning the strings without that character.
7. Calculating the number of days between a given date and the current date.
8. Drawing shapes like
This document contains 9 Java programming assignments from a BCA semester course. Each assignment demonstrates a different Java concept such as typecasting, bitwise operators, string operations, inheritance, polymorphism, packages, interfaces, threads, and abstract classes. The assignments include code snippets to demonstrate the concepts and the expected output when the code is compiled and run.
The document describes an example Java program that defines classes for a banking application including accounts, customers, and transactions. Key points:
1) It defines interfaces for interest rates and transactions that account classes can implement.
2) An abstract Account class and concrete SBAccount class that extends Account are defined.
3) A Customer class holds an SBAccount and allows transactions like deposit, withdraw, interest calculation.
4) A BankDemo class demonstrates creating a customer and performing sample transactions.
The document contains 15 Java programs demonstrating various programming concepts:
1. A "Hello World" program to print text
2. A class defining student attributes and methods to input/display student data
3. A class demonstrating constructor and method overloading
4. A program implementing command line arguments
5. A program demonstrating methods of the String class
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
The question asks to create classes to represent publications, books, and tapes. The Publication class has title and price attributes. The Book class inherits from Publication and adds a noOfPages attribute. The Tape class inherits from Publication and adds a playingTime attribute.
The document contains code snippets in Java for getting different types of information. This includes code to get the hostname, month from a date, IP address, memory size and usage, and more. The code uses various Java classes and methods like InetAddress, DateFormat, Runtime etc. to retrieve the desired information and print/return the output.
The document contains 17 code snippets that demonstrate various Java programming concepts like loops, arrays, methods, classes, input/output, etc. Specifically, the code snippets show:
1. Using for loops to print numeric series
2. Accepting user input of different data types using Scanner and parsing
3. Using StringTokenizer and Scanner classes
4. Finding largest number among 3 inputs and printing tables
5. Demonstrating 2D arrays, array of objects, and command line arguments
6. Various String class methods like length(), substring(), indexOf() etc.
The document contains 21 programming problems involving Java concepts like arrays, loops, methods, classes, objects, constructors, and more. For each problem, source code is provided to demonstrate how to solve the problem, followed by sample output. Some key problems include: (1) printing series using nested loops, (2) receiving user input of different data types, (3) using StringTokenizer and Scanner classes, (4) finding largest of 3 numbers, (5) using 2D arrays and array of objects.
This document contains code written by Ankit Gupta for an assignment. It includes 6 Java programs: 1) A program to calculate the sum of first n numbers using a for loop. 2) A program to find the maximum of n numbers using a do-while loop. 3) A program to find all Armstrong numbers between 0 and 999. 4) A program to correct common typing errors. 5) A program to solve a problem related to the gangster Dawood Abrahim. 6) Additional Java programs and problems solved by Ankit Gupta.
The document discusses constructors in Java. It explains that the new keyword is used to create an object and precedes a call to the class constructor. The constructor initializes the new object and can only be called by other constructors or static methods. It provides an example BankAccount class with a no-argument constructor that calls another constructor with a parameter, and a constructor that initializes the balance field and calls a static method.
The document discusses various object-oriented programming concepts in Java including inheritance, subclasses, overriding methods, constructors, and modifiers for classes, variables, constructors, and methods. It provides examples to demonstrate inheritance hierarchies, accessing variables and methods from superclasses, constructor invocation order, abstract classes, and usage of access modifiers like public, private, and protected.
The document provides examples of various Java programming concepts like displaying messages, using control structures like if-else, for loops, methods, constructors, access specifiers, static variables and more. It shows how to write simple Java programs to print messages, integers, use conditional and looping statements. It also explains concepts like default and parameterized constructors, static and non-static methods, different access specifiers and their usage. The examples help learn how different Java features can be used to develop programs with classes, objects and methods.
I dont know what is wrong with this roulette program I cant seem.pdfarchanaemporium
I don\'t know what is wrong with this roulette program I can\'t seem to get it to run.
Game Class:
public class Game {
public static void main(String[] args) {
Table table = new Table();
BinBuilder bb = new BinBuilder();
Outcome black = new Outcome(\"Black\", 35);
Bet bet = new Bet(10, black);
table.placeBet(bet);
Bin bin = bb.wheel.get(8);
System.out.println(bin.toString());
System.out.println(table.bets.toString());
System.out.println(black.toString());
ListIterator i = table.bets.listIterator();
Iterator b = bin.outcomes.iterator();
while(i.hasNext()) {
System.out.println(i.next().outcome.name.toString());
while(b.hasNext()){
System.out.println(b.next().name.toString());
if(i.next().outcome.equals(b.next())){
System.out.println(\"Win!\");
}
else{
System.out.println(\"Win :/\");
}
}
}
}
}
Player Class
public class Player {
public Table table;
public Outcome black;
public Bet bet;
public Player(Table table) {
table = new Table();
black = new Outcome(\"Black\", 1);
}
void placeBets() {
Bet bet = new Bet(100, black);
table.placeBet(bet);
}
void win(Bet bet) {
System.out.println(\"You\'ve won: \" + bet.winAmount());
}
void lose(Bet bet) {
System.out.println(\"You lost!\" + bet.loseAmount() + \":/\");
}
}
Outcome class
public class Outcome implements Comparable {
public String name;
public int odds;
public Outcome(String name, int odds){
this.name = name;
this.odds = odds;
}
public int winAmount(int amount){
return amount*this.odds;
}
public boolean equals(Outcome other){
return (this.name.equals(other.name));
}
public String toString() {
Object[] values= { name, new Integer(odds) };
String msgTempl= \"{0} ({1}:1)\";
return MessageFormat.format( msgTempl, values );
}
@Override
public int compareTo(E arg0) {
if(this.equals(arg0)){
return 0;
}
return 1;
}
}
Table Class
public class Table {
public int limit = 1000;
public LinkedList bets;
public Table() {
bets = new LinkedList();
}
public boolean isValid(Bet bet) {
int sum = 0;
for(Bet bett: bets) {
sum += bett.amountBet;
}
return (sum>limit);
}
public void placeBet(Bet bet) {
bets.add(bet);
}
ListIterator iterator() {
return bets.listIterator();
}
}
Wheel Class
public class Wheel extends TreeSet {
Vector bins;
NonRandom rng;
Set all_outcomes;
Wheel(NonRandom rng){
this.rng = rng;
rng = new NonRandom();
all_outcomes = new TreeSet();
bins = new Vector(38);
for (int i=0; i<38; i++){
bins.add(i, new Bin());
}
}
Bin next(){
int rand = rng.next(38);
return bins.elementAt(rand);
}
Bin get(int bin){
return bins.elementAt(bin);
}
public Outcome getOutcome( String name ){
TreeSet result= new TreeSet();
for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) {
Outcome oc= i.next();
if( oc.name.contains(name) ) {result.add( oc );}
}
return result.first();
}
public void addOutcome(int bin, Outcome outcome) {
all_outcomes.add(outcome);
this.bins.elementAt(bin).add(outcome);
}
}
Bet Class
public class Bet {
public int amountBet;
public Outcome outcome;
public Bet(int amount, Outcome outcome) {
this.outcome = o.
The document discusses various object-oriented programming concepts in Java like inheritance, polymorphism, abstraction and interfaces. It provides code examples to demonstrate single inheritance, method overriding, abstract classes, interfaces and extending interfaces. Static and final keywords are also explained with examples.
Q3 GIVEN THE TREND EQUATION NO OF STUDENTS-3000+200 YEAR BASE: 2003-0
1.INTERPRET EQUATION RESULTS 2.FORECAST FOR 2020 3.WHEN WILL THE NO OF
STUDENTS REACH 6000
Solution
x no of years from 2003 y no of students y = 3000+200x 1) The regression
equation has a positive slope of 200 y intercept is 3000 i.e. no of students in the year 2000
Thus for every year 200 students increase 2) For 2020, x = 17, y = 3000+200(17) = 6400
3) When y =6000, 6000 = 3000+200x or x = 15 Hence in year 2018 students reach 6000
B Regression C D. All the above.
The document contains code for 9 Java programming practical assignments. The first practical accepts coefficients for a quadratic equation, calculates the roots and outputs the results. The second accepts two matrices as input and calculates their addition. The third sorts an array of strings in ascending order. The fourth creates an Animal interface and classes that implement it to demonstrate polymorphism. The remaining practicals demonstrate inheritance, exceptions, GUI programming using Swing components, and the List interface.
The document contains 7 Java programs written by Ankit Gupta. The programs include:
1) A program to print two strings on separate lines
2) A program to find the multiplication and geometric mean of 4 input numbers
3) A program to calculate the volume of a cylinder given its height and radius
4) A program to convert centimeters to feet and inches
5) A program to convert seconds to hours, minutes and seconds
6) A program to determine if the roots of a quadratic equation are real, complex, equal or distinct
7) The author's name and information is included before each program
This document contains code that implements inheritance and method overloading. It defines a base mob class with getmob and putmob methods to retrieve and display student roll number and name. The drive class inherits from mob and overloads getdrive and putdrive methods to also retrieve and display subject marks. The pen class inherits from drive and overloads getresult and putresult methods to calculate and display the total marks. The main method creates a pen object and calls its methods.
This presentation was provided by Racquel Jemison, Ph.D., Christina MacLaughlin, Ph.D., and Paulomi Majumder. Ph.D., all of the American Chemical Society, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
The document describes Java programs to demonstrate various concepts:
1. Generating a WiFi password based on user input of name, city, age, and gender.
2. Finding the character with the second highest frequency in a string.
3. Finding the longest subsequence of the same character in a string.
4. Generating a WiFi key based on user input of name, city, age, and gender.
5. Deleting non-empty text files from a specified folder.
6. Checking if a character appears twice in two strings and returning the strings without that character.
7. Calculating the number of days between a given date and the current date.
8. Drawing shapes like
This document contains 9 Java programming assignments from a BCA semester course. Each assignment demonstrates a different Java concept such as typecasting, bitwise operators, string operations, inheritance, polymorphism, packages, interfaces, threads, and abstract classes. The assignments include code snippets to demonstrate the concepts and the expected output when the code is compiled and run.
The document describes an example Java program that defines classes for a banking application including accounts, customers, and transactions. Key points:
1) It defines interfaces for interest rates and transactions that account classes can implement.
2) An abstract Account class and concrete SBAccount class that extends Account are defined.
3) A Customer class holds an SBAccount and allows transactions like deposit, withdraw, interest calculation.
4) A BankDemo class demonstrates creating a customer and performing sample transactions.
The document contains 15 Java programs demonstrating various programming concepts:
1. A "Hello World" program to print text
2. A class defining student attributes and methods to input/display student data
3. A class demonstrating constructor and method overloading
4. A program implementing command line arguments
5. A program demonstrating methods of the String class
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
The question asks to create classes to represent publications, books, and tapes. The Publication class has title and price attributes. The Book class inherits from Publication and adds a noOfPages attribute. The Tape class inherits from Publication and adds a playingTime attribute.
The document contains code snippets in Java for getting different types of information. This includes code to get the hostname, month from a date, IP address, memory size and usage, and more. The code uses various Java classes and methods like InetAddress, DateFormat, Runtime etc. to retrieve the desired information and print/return the output.
The document contains 17 code snippets that demonstrate various Java programming concepts like loops, arrays, methods, classes, input/output, etc. Specifically, the code snippets show:
1. Using for loops to print numeric series
2. Accepting user input of different data types using Scanner and parsing
3. Using StringTokenizer and Scanner classes
4. Finding largest number among 3 inputs and printing tables
5. Demonstrating 2D arrays, array of objects, and command line arguments
6. Various String class methods like length(), substring(), indexOf() etc.
The document contains 21 programming problems involving Java concepts like arrays, loops, methods, classes, objects, constructors, and more. For each problem, source code is provided to demonstrate how to solve the problem, followed by sample output. Some key problems include: (1) printing series using nested loops, (2) receiving user input of different data types, (3) using StringTokenizer and Scanner classes, (4) finding largest of 3 numbers, (5) using 2D arrays and array of objects.
This document contains code written by Ankit Gupta for an assignment. It includes 6 Java programs: 1) A program to calculate the sum of first n numbers using a for loop. 2) A program to find the maximum of n numbers using a do-while loop. 3) A program to find all Armstrong numbers between 0 and 999. 4) A program to correct common typing errors. 5) A program to solve a problem related to the gangster Dawood Abrahim. 6) Additional Java programs and problems solved by Ankit Gupta.
The document discusses constructors in Java. It explains that the new keyword is used to create an object and precedes a call to the class constructor. The constructor initializes the new object and can only be called by other constructors or static methods. It provides an example BankAccount class with a no-argument constructor that calls another constructor with a parameter, and a constructor that initializes the balance field and calls a static method.
The document discusses various object-oriented programming concepts in Java including inheritance, subclasses, overriding methods, constructors, and modifiers for classes, variables, constructors, and methods. It provides examples to demonstrate inheritance hierarchies, accessing variables and methods from superclasses, constructor invocation order, abstract classes, and usage of access modifiers like public, private, and protected.
The document provides examples of various Java programming concepts like displaying messages, using control structures like if-else, for loops, methods, constructors, access specifiers, static variables and more. It shows how to write simple Java programs to print messages, integers, use conditional and looping statements. It also explains concepts like default and parameterized constructors, static and non-static methods, different access specifiers and their usage. The examples help learn how different Java features can be used to develop programs with classes, objects and methods.
I dont know what is wrong with this roulette program I cant seem.pdfarchanaemporium
I don\'t know what is wrong with this roulette program I can\'t seem to get it to run.
Game Class:
public class Game {
public static void main(String[] args) {
Table table = new Table();
BinBuilder bb = new BinBuilder();
Outcome black = new Outcome(\"Black\", 35);
Bet bet = new Bet(10, black);
table.placeBet(bet);
Bin bin = bb.wheel.get(8);
System.out.println(bin.toString());
System.out.println(table.bets.toString());
System.out.println(black.toString());
ListIterator i = table.bets.listIterator();
Iterator b = bin.outcomes.iterator();
while(i.hasNext()) {
System.out.println(i.next().outcome.name.toString());
while(b.hasNext()){
System.out.println(b.next().name.toString());
if(i.next().outcome.equals(b.next())){
System.out.println(\"Win!\");
}
else{
System.out.println(\"Win :/\");
}
}
}
}
}
Player Class
public class Player {
public Table table;
public Outcome black;
public Bet bet;
public Player(Table table) {
table = new Table();
black = new Outcome(\"Black\", 1);
}
void placeBets() {
Bet bet = new Bet(100, black);
table.placeBet(bet);
}
void win(Bet bet) {
System.out.println(\"You\'ve won: \" + bet.winAmount());
}
void lose(Bet bet) {
System.out.println(\"You lost!\" + bet.loseAmount() + \":/\");
}
}
Outcome class
public class Outcome implements Comparable {
public String name;
public int odds;
public Outcome(String name, int odds){
this.name = name;
this.odds = odds;
}
public int winAmount(int amount){
return amount*this.odds;
}
public boolean equals(Outcome other){
return (this.name.equals(other.name));
}
public String toString() {
Object[] values= { name, new Integer(odds) };
String msgTempl= \"{0} ({1}:1)\";
return MessageFormat.format( msgTempl, values );
}
@Override
public int compareTo(E arg0) {
if(this.equals(arg0)){
return 0;
}
return 1;
}
}
Table Class
public class Table {
public int limit = 1000;
public LinkedList bets;
public Table() {
bets = new LinkedList();
}
public boolean isValid(Bet bet) {
int sum = 0;
for(Bet bett: bets) {
sum += bett.amountBet;
}
return (sum>limit);
}
public void placeBet(Bet bet) {
bets.add(bet);
}
ListIterator iterator() {
return bets.listIterator();
}
}
Wheel Class
public class Wheel extends TreeSet {
Vector bins;
NonRandom rng;
Set all_outcomes;
Wheel(NonRandom rng){
this.rng = rng;
rng = new NonRandom();
all_outcomes = new TreeSet();
bins = new Vector(38);
for (int i=0; i<38; i++){
bins.add(i, new Bin());
}
}
Bin next(){
int rand = rng.next(38);
return bins.elementAt(rand);
}
Bin get(int bin){
return bins.elementAt(bin);
}
public Outcome getOutcome( String name ){
TreeSet result= new TreeSet();
for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) {
Outcome oc= i.next();
if( oc.name.contains(name) ) {result.add( oc );}
}
return result.first();
}
public void addOutcome(int bin, Outcome outcome) {
all_outcomes.add(outcome);
this.bins.elementAt(bin).add(outcome);
}
}
Bet Class
public class Bet {
public int amountBet;
public Outcome outcome;
public Bet(int amount, Outcome outcome) {
this.outcome = o.
The document discusses various object-oriented programming concepts in Java like inheritance, polymorphism, abstraction and interfaces. It provides code examples to demonstrate single inheritance, method overriding, abstract classes, interfaces and extending interfaces. Static and final keywords are also explained with examples.
Q3 GIVEN THE TREND EQUATION NO OF STUDENTS-3000+200 YEAR BASE: 2003-0
1.INTERPRET EQUATION RESULTS 2.FORECAST FOR 2020 3.WHEN WILL THE NO OF
STUDENTS REACH 6000
Solution
x no of years from 2003 y no of students y = 3000+200x 1) The regression
equation has a positive slope of 200 y intercept is 3000 i.e. no of students in the year 2000
Thus for every year 200 students increase 2) For 2020, x = 17, y = 3000+200(17) = 6400
3) When y =6000, 6000 = 3000+200x or x = 15 Hence in year 2018 students reach 6000
B Regression C D. All the above.
The document contains code for 9 Java programming practical assignments. The first practical accepts coefficients for a quadratic equation, calculates the roots and outputs the results. The second accepts two matrices as input and calculates their addition. The third sorts an array of strings in ascending order. The fourth creates an Animal interface and classes that implement it to demonstrate polymorphism. The remaining practicals demonstrate inheritance, exceptions, GUI programming using Swing components, and the List interface.
The document contains 7 Java programs written by Ankit Gupta. The programs include:
1) A program to print two strings on separate lines
2) A program to find the multiplication and geometric mean of 4 input numbers
3) A program to calculate the volume of a cylinder given its height and radius
4) A program to convert centimeters to feet and inches
5) A program to convert seconds to hours, minutes and seconds
6) A program to determine if the roots of a quadratic equation are real, complex, equal or distinct
7) The author's name and information is included before each program
This document contains code that implements inheritance and method overloading. It defines a base mob class with getmob and putmob methods to retrieve and display student roll number and name. The drive class inherits from mob and overloads getdrive and putdrive methods to also retrieve and display subject marks. The pen class inherits from drive and overloads getresult and putresult methods to calculate and display the total marks. The main method creates a pen object and calls its methods.
Similar to PROGRAMING IN JAVA 4TH SEM DIGVIJAY COLLAGE (20)
This presentation was provided by Racquel Jemison, Ph.D., Christina MacLaughlin, Ph.D., and Paulomi Majumder. Ph.D., all of the American Chemical Society, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
The chapter Lifelines of National Economy in Class 10 Geography focuses on the various modes of transportation and communication that play a vital role in the economic development of a country. These lifelines are crucial for the movement of goods, services, and people, thereby connecting different regions and promoting economic activities.
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PROGRAMING IN JAVA 4TH SEM DIGVIJAY COLLAGE
1. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 1
Q.1 WAP to implement the concept of Encapsulation.
CODING :-
import java.util.*;
import java.io.*;
class Person
{
private String name ;
private int age;
public String getName()
{
return name;
}
public void setName(String name) //Setter Method
{
this.name = name;
}
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
}
public class Pmain
{
2. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 2
public static void main(String args[]) // main function
{
Person p = new Person();
p.setName("Yash Tandekar");
p.setAge(21);
System.out.println("Name : " + p.getName() );
System.out.println("Age : " + p.getAge() );
}
}
OUTPUT :-
PTO
3. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 3
Q.2 WAP for Boolean Data type and print the Prime number series upto 50.
CODING :-
import java.util.*;
import java.io.*;
public class PrimeNumber
{
public static boolean isPrime(int num)
{
if (num <= 1)
{
return false;
}
for (int i = 2; i * i <= num; i++)
{
if (num % i == 0)
{
return false;
}
}
return true;
}
public static void main(String args[])
{
System.out.println("Prime numbers up to 50:");
for (int i = 2; i <= 50; i++)
{
5. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 5
Q.3 Write a program to demonstrate Method Overloading in java.
CODING :-
import java.util.*;
import java.io.*;
public class Sum
{
public int sum(int x, int y)
{
return (x + y);
}
public int sum(int x, int y, int z)
{
return (x + y + z);
}
public double sum(double x, double y)
{
return (x + y);
}
public static void main(String args[])
{
Sum s = new Sum();
System.out.println(" METHOD OVERLOADING ");
System.out.println(" -: Inside First Sum Block :-");
System.out.println("t" +s.sum(10, 20));
6. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 6
System.out.println(" n-: Inside Second Sum Block :-");
System.out.println("t" +s.sum(10, 20, 30));
System.out.println(" n-: Inside Third Sum Block :-");
System.out.println("t" +s.sum(10.5, 20.5));
}
}
OUTPUT :-
P.T.O.
7. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 7
Q.4 WAP for Multiplication of Matrix using input/output string.
CODING :-
import java.util.Scanner;
import java.io.*;
public class UserInputMatrixMultiplication
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the number of rows for the first matrix: ");
int rows1 = scanner.nextInt();
System.out.print("Enter the number of columns for the first matrix: ");
int cols1 = scanner.nextInt();
System.out.print("Enter the number of rows for the second matrix: ");
int rows2 = scanner.nextInt();
System.out.print("Enter the number of columns for the second matrix: ");
int cols2 = scanner.nextInt();
if (cols1 != rows2)
{
System.err.println("Error: Number of columns in first matrix must equal
number of rows in second matrix for multiplication.");
return;
}
int[][] matrix1 = new int[rows1][cols1];
int[][] matrix2 = new int[rows2][cols2];
8. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 8
// Get elements of first matrix
System.out.println("Enter elements for the first matrix (row-wise):");
for (int i = 0; i < rows1; i++)
{
for (int j = 0; j < cols1; j++)
{
System.out.print("Enter element [" + (i + 1) + "][" + (j + 1) + "]: ");
matrix1[i][j] = scanner.nextInt();
}
}
// Get elements of second matrix
System.out.println("Enter elements for the second matrix (row-wise):");
for (int i = 0; i < rows2; i++)
{
for (int j = 0; j < cols2; j++)
{
System.out.print("Enter element [" + (i + 1) + "][" + (j + 1) + "]: ");
matrix2[i][j] = scanner.nextInt();
}
}
// Create a result matrix to store the product
int[][] result = new int[rows1][cols2];
// Perform matrix multiplication
for (int i = 0; i < rows1; i++)
9. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 9
{
for (int j = 0; j < cols2; j++)
{
result[i][j] = 0;
for (int k = 0; k < cols1; k++)
{
result[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
// Print the result matrix
System.out.println("Result Matrix:");
for (int i = 0; i < rows1; i++)
{
for (int j = 0; j < cols2; j++)
{
System.out.print(result[i][j] + " ");
}
System.out.println();
}
scanner.close();
}
}
P.T.O.
13. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 13
Q.6 WAP to perform autoboxing and unboxing in Wrapper class.
CODING :-
import java.util.*;
import java.io.*;
class AUboxing
{
public static void main(String args[])
{
Character gfg = 'a';
char ch = gfg;
System.out.println("-: Autoboxing of character :-n");
System.out.println("Value of ch: " + ch);
System.out.println(" -: Unboxing of Character :-n");
System.out.println(" Value of gfg: " + gfg);
}
}
OUTPUT :-
P.T.O.
14. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 14
Q.7 WAP to calculate Area of various geometrical figures using the
abstract class.
CODING :-
import java.math.BigDecimal;
import java.util.*;
import java.io.*;
abstract class Shape
{
public abstract BigDecimal calculateArea();
}
class Square extends Shape
{
private final BigDecimal side;
public Square(BigDecimal side)
{
this.side = side;
}
public BigDecimal calculateArea()
{
return side.multiply(side);
}
}
class Rectangle extends Shape
{
15. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 15
private final BigDecimal length;
private final BigDecimal breadth;
public Rectangle(BigDecimal length, BigDecimal breadth)
{
this.length = length;
this.breadth = breadth;
}
public BigDecimal calculateArea()
{
return length.multiply(breadth);
}
}
class Circle extends Shape
{
private final BigDecimal radius;
public Circle(BigDecimal radius)
{
this.radius = radius;
}
public BigDecimal calculateArea()
{
BigDecimal pi = new BigDecimal("3.14159");
return pi.multiply(radius.multiply(radius));
16. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 16
}
}
public class AreaCalculator
{
public static void main(String args[])
{
Shape square = new Square(new BigDecimal(5));
Shape rectangle = new Rectangle(new BigDecimal(4), new BigDecimal(6));
Shape circle = new Circle(new BigDecimal(3));
System.out.println(" -: Abstract Method Used Here :-n");
System.out.println("Area of Square is - " + square.calculateArea());
System.out.println("nArea of Rectangle is - " + rectangle.calculateArea());
System.out.println("nArea of Circle is: " + circle.calculateArea());
}
}
OUTPUT :-
17. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 17
Q.8 Write a program where single class implements the more than one
interface and with the help of interface reference variable user call the
method.
CODING :-
import java.util.*;
import java.io.*;
interface Drawable
{
void draw();
}
interface Speakable
{
void speak();
}
class Animal implements Drawable, Speakable
Drawable and Speakable interfaces
{
public void draw()
{
System.out.println("Drawing a animal...");
}
public void speak()
{
System.out.println("Animal sound (as they Speak)");
}
}
18. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 18
public class InterfaceUsage //Main Class
{
public static void main(String args[]) //Main Method
{
Animal a = new Animal();
Drawable dA = a;// Use interface reference variables to call specific methods
dA.draw();
Speakable spA = a;
spA.speak(); }
}
OUTPUT :-
19. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 19
Q.9 WAP to create a package using command and one package will
import the another package.
CODING :-
Package 1 yash :
package yash;
public class Sum
{
public static int add(int a, int b)
{
return a + b;
}
}
Package 2 : another
import java.util.*;
import java.io.*;
package another;
import yash.Sum; // Import the Sum class of yash package
public class Add
{
public static void main(String args[])
{
int sum = Sum.add(5, 3);
System.out.println("Sum of 5 and 3 is: " + sum);
}
}
OUTPUT :-
P.T.O.
20. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 20
Q.10 WAP that use multiple catch statements within the try-catch
mechanism.
CODING :-
import java.util.*;
import java.io.*;
public class MultipleCatchExp
{
public static void main(String args[])
{
int num = 10;
String str = null;
System.out.println("Num = " +num);
try
{
int result = num / 0;
int strLength = str.length();
}
catch (ArithmeticException e)
{
System.out.println("Caught ArithmeticException: Division by zero");
}
catch (NullPointerException e)
{
System.out.println("Caught NullPointerException: Accessing null
object");
}
finally
22. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 22
Q.11 WAP where user will create a self-Exception using the “throw”
keyword.
CODING :-
import java.util.*;
import java.io.*;
public class SelfException
{
public static void validateAge(int age) throws AgeException
{
if (age < 18)
{
throw new AgeException(".......Age must be 18 or older.......");
}
System.out.println("Age is valid: " + age);
}
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your age: ");
int userAge = scanner.nextInt();
try
{
validateAge(userAge);
}
catch (AgeException e)
{
24. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 24
Q.12 WAP to demonstrate Multilevel Inheritance in java.
CODING :-
import java.util.*;
import java.io.*;
class Vehicle
{
public void move()
{
System.out.println("Vehicle is moving.");
}
}
class Car extends Vehicle
{
public void openDoors()
{
System.out.println("Car doors are open.");
}
}
class SportsCar extends Car
{
public void accelerate()
{
System.out.println("Sports car is accelerating!");
}
}
25. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 25
public class MultilevelExp //main Class
{
public static void main(String args[])
{
SportsCar SC = new SportsCar();
System.out.println(" .....-: Multi Level inheritance Used Here :-.....n");
SC.move(); // Inherited from Vehicle
SC.openDoors(); // Inherited from Car
SC.accelerate(); // Specific to SportsCar
}
}
OUTPUT :-
P.T.O.
26. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 26
Q.13 WAP for Vector class which perform the all methods of that
class.
CODING :-
import java.io.*;
import java.util.Vector;
public class VectorExp
{
public static void main(String args[])
{
Vector<String> fruits = new Vector<>(5);
System.out.println("......Using add() Method......n");
fruits.add("Apple");
fruits.add("Banana");
fruits.add("Orange");
System.out.println(" Vector after adding elements - " + fruits);
fruits.add(1, "Mango");
System.out.println(" Vector after adding element at index 1 - " + fruits);
System.out.println("n......Using remove() Method......n");
fruits.remove(0);
System.out.println(" Vector after removing element at index 0 - " + fruits);
fruits.removeElement("Orange");
System.out.println("Vector after removing element 'Orange': " + fruits);
28. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 28
Q.14 WAP to create a simple class to find out the area and perimeter
of rectangle using super and this keyword.
CODING :-
import java.util.*;
import java.io.*;
public class Rectangle
{
private double length;
private double width;
public Rectangle(double length, double width)
{
this.length = length;
this.width = width;
}
public double calculateArea()
{
return length * width;
}
public double calculatePerimeter()
{
return 2 * (length + width);
}
public static void main(String[] args) // Main method
{
Rectangle rectangle = new Rectangle(5.0, 3.0);
29. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 29
double area = rectangle.calculateArea();
double perimeter = rectangle.calculatePerimeter();
System.out.println("Area of rectangle: " + area);
System.out.println("Perimeter of rectangle: " + perimeter);
}
}
OUTPUT :-
P.T.O
30. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 30
Q.15 WAP for Applet that handle the keyboard Events.
CODING :-
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
/* <APPLET CODE ="AppletKeyboard.class" WIDTH=300 HEIGHT=200>
</APPLET> */
public class AppletKeyboard extends Applet implements KeyListener
{
TextField t,tt,tp,tr;
public void init()
{
t=new TextField(20);
t.addKeyListener(this);
tt=new TextField(70);
tp=new TextField(70);
tr=new TextField(70);
add(t);
add(tt);
add(tr);
add(tp);
}
public void keyTyped(KeyEvent e)
{
tt.setText("key Released"+e.getKeyChar());
}
public void keyReleased(KeyEvent e)
{
32. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 32
Q.16 WAP to illustrate the use of all methods of URL class.
CODING :-
import java.util.*;
import java.net.*;
public class URLDemo
{
public static void main(String[] args)
{
try{
URL url=new
URL("https://www.google.com/search?q=javatpoint&oq=javatpoint&sourceid=chro
me&ie=UTF-8");
System.out.println("Protocol: "+url.getProtocol());
System.out.println("Host Name: "+url.getHost());
System.out.println("Port Number: "+url.getPort());
System.out.println("Default Port Number: "+url.getDefaultPort());
System.out.println("Path: "+url.getPath());
System.out.println("File: "+url.getFile());
}catch(Exception e){System.out.println(e);}
}
}
OUTPUT :-
33. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 33
Q.17 WAP for AWT to create Menu and Popup Menu for Frame.
CODING :-
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class MenuAndPopupMenuExample extends Frame implements
ActionListener
{
private MenuBar menuBar;
private Menu fileMenu, editMenu;
private PopupMenu popupMenu;
public MenuAndPopupMenuExample()
{
super("Menu and Popup Menu Example");
menuBar = new MenuBar(); // Create MenuBar and Menus
fileMenu = new Menu("File");
editMenu = new Menu("Edit");
menuBar.add(fileMenu);
menuBar.add(editMenu);
// Add Menu Items to File Menu
MenuItem newMenuItem = new MenuItem("New");
newMenuItem.addActionListener(this);
fileMenu.add(newMenuItem);
MenuItem openMenuItem = new MenuItem("Open");
openMenuItem.addActionListener(this);
fileMenu.add(openMenuItem);
34. PROGRAMMING IN JAVA 2023-24
YASHWANT KUMAR TANDEKAR (BCA 4 th
SEM) Page 34
fileMenu.addSeparator(); // Add separator line
MenuItem exitMenuItem = new MenuItem("Exit");
exitMenuItem.addActionListener(this);
fileMenu.add(exitMenuItem);
popupMenu = new PopupMenu(); // Create Popup Menu
MenuItem copyMenuItem = new MenuItem("Copy");
copyMenuItem.addActionListener(this);
popupMenu.add(copyMenuItem);
MenuItem pasteMenuItem = new MenuItem("Paste");
pasteMenuItem.addActionListener(this);
popupMenu.add(pasteMenuItem);
setMenuBar(menuBar);
setSize(400, 300);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String action = e.getActionCommand();
System.out.println("Menu Item Selected: " + action);
}
public static void main(String args[])
{