SlideShare a Scribd company logo
Listing.java
import java.util.Scanner;
public class Listing {
//Declaring instance variables
private String name;
private int age;
//Default constructor
public Listing() {
name=" ";
age=0;
}
//parameterized Constructor
public Listing(String name, int age) {
super();
this.name = name;
this.age = age;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
//This input() method will take the inputs entered by the user.
public void input()
{
//Scanner Object is used to get the data entered by the user
Scanner sc=new Scanner(System.in);
//Getting the user name
System.out.print("Enter Name :");
setName(sc.nextLine());
//Getting the Age
System.out.print("Enter Age :");
setAge(sc.nextInt());
}
//This toString() method will displays the constents of the user.
@Override
public String toString() {
System.out.println("Name :"+getName());
System.out.println("Name :"+getAge());
return "";
}
}
_____________________________________________________________
Driver.java
public class Driver {
public static void main(String[] args) {
//Create an array of 3 Listing Objects
Listing listing[]=new Listing[3];
//Creating Listing Objects and populating into an Array
for(int i=0;i<3;i++)
{
listing[i]=new Listing();
System.out.println("Listing Object "+(i+1)+":");
//Calling the input method which capture the data entered by the user
listing[i].input();
}
//Displaying the Listing objects in the Normal Order
System.out.println("Displaying the Listing Objects in the Normal Order ::");
for(int i=0;i<3;i++)
{
System.out.println("Listing Object "+(i+1)+":");
listing[i].toString();
System.out.println("_____________________");
}
//Displaying the Listing objects in the Reverse Order
System.out.println("Displaying the Listing Objects in the Reverse Order ::");
for(int i=2;i>=0;i--)
{
System.out.println("Listing Object "+(i+1)+":");
listing[i].toString();
System.out.println("_____________________");
}
}
}
_______________________________________________________
Output:
Listing Object 1:
Enter Name :Kane Williams
Enter Age :27
Listing Object 2:
Enter Name :John Mills
Enter Age :23
Listing Object 3:
Enter Name :Tim Rochey
Enter Age :22
Displaying the Listing Objects in the Normal Order ::
Listing Object 1:
Name :Kane Williams
Name :27
_____________________
Listing Object 2:
Name :John Mills
Name :23
_____________________
Listing Object 3:
Name :Tim Rochey
Name :22
_____________________
Displaying the Listing Objects in the Reverse Order ::
Listing Object 3:
Name :Tim Rochey
Name :22
_____________________
Listing Object 2:
Name :John Mills
Name :23
_____________________
Listing Object 1:
Name :Kane Williams
Name :27
_____________________
_____________________________________________Thank You
Solution
Listing.java
import java.util.Scanner;
public class Listing {
//Declaring instance variables
private String name;
private int age;
//Default constructor
public Listing() {
name=" ";
age=0;
}
//parameterized Constructor
public Listing(String name, int age) {
super();
this.name = name;
this.age = age;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
//This input() method will take the inputs entered by the user.
public void input()
{
//Scanner Object is used to get the data entered by the user
Scanner sc=new Scanner(System.in);
//Getting the user name
System.out.print("Enter Name :");
setName(sc.nextLine());
//Getting the Age
System.out.print("Enter Age :");
setAge(sc.nextInt());
}
//This toString() method will displays the constents of the user.
@Override
public String toString() {
System.out.println("Name :"+getName());
System.out.println("Name :"+getAge());
return "";
}
}
_____________________________________________________________
Driver.java
public class Driver {
public static void main(String[] args) {
//Create an array of 3 Listing Objects
Listing listing[]=new Listing[3];
//Creating Listing Objects and populating into an Array
for(int i=0;i<3;i++)
{
listing[i]=new Listing();
System.out.println("Listing Object "+(i+1)+":");
//Calling the input method which capture the data entered by the user
listing[i].input();
}
//Displaying the Listing objects in the Normal Order
System.out.println("Displaying the Listing Objects in the Normal Order ::");
for(int i=0;i<3;i++)
{
System.out.println("Listing Object "+(i+1)+":");
listing[i].toString();
System.out.println("_____________________");
}
//Displaying the Listing objects in the Reverse Order
System.out.println("Displaying the Listing Objects in the Reverse Order ::");
for(int i=2;i>=0;i--)
{
System.out.println("Listing Object "+(i+1)+":");
listing[i].toString();
System.out.println("_____________________");
}
}
}
_______________________________________________________
Output:
Listing Object 1:
Enter Name :Kane Williams
Enter Age :27
Listing Object 2:
Enter Name :John Mills
Enter Age :23
Listing Object 3:
Enter Name :Tim Rochey
Enter Age :22
Displaying the Listing Objects in the Normal Order ::
Listing Object 1:
Name :Kane Williams
Name :27
_____________________
Listing Object 2:
Name :John Mills
Name :23
_____________________
Listing Object 3:
Name :Tim Rochey
Name :22
_____________________
Displaying the Listing Objects in the Reverse Order ::
Listing Object 3:
Name :Tim Rochey
Name :22
_____________________
Listing Object 2:
Name :John Mills
Name :23
_____________________
Listing Object 1:
Name :Kane Williams
Name :27
_____________________
_____________________________________________Thank You

More Related Content

Similar to Listing.javaimport java.util.Scanner;public class Listing {   .pdf

Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
anokhijew
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
ArafatSahinAfridi
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
ankitmobileshop235
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
ssuser562afc1
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
arracollection
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdf
arihantgiftgallery
 
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdfCreate a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
lakshmijewellery
 
Kotlin Data Model
Kotlin Data ModelKotlin Data Model
Kotlin Data Model
Kros Huang
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
dbrienmhompsonkath75
 
Defining classes-and-objects-1.0
Defining classes-and-objects-1.0Defining classes-and-objects-1.0
Defining classes-and-objects-1.0
BG Java EE Course
 
Logincode
LogincodeLogincode
Logincode
RidwanSomali
 
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
taobao.com
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdf
aquadreammail
 
when I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docxwhen I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docx
lashandaotley
 
Overview You are tasked with writing a program called Social Security.pdf
Overview You are tasked with writing a program called Social Security.pdfOverview You are tasked with writing a program called Social Security.pdf
Overview You are tasked with writing a program called Social Security.pdf
info961251
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
fashioncollection2
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
forwardcom41
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdf
aashienterprisesuk
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
aarokyaaqua
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 

Similar to Listing.javaimport java.util.Scanner;public class Listing {   .pdf (20)

Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdf
 
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdfCreate a Code that will add an Add, Edi, and Delete button to the GU.pdf
Create a Code that will add an Add, Edi, and Delete button to the GU.pdf
 
Kotlin Data Model
Kotlin Data ModelKotlin Data Model
Kotlin Data Model
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
Defining classes-and-objects-1.0
Defining classes-and-objects-1.0Defining classes-and-objects-1.0
Defining classes-and-objects-1.0
 
Logincode
LogincodeLogincode
Logincode
 
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdf
 
when I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docxwhen I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docx
 
Overview You are tasked with writing a program called Social Security.pdf
Overview You are tasked with writing a program called Social Security.pdfOverview You are tasked with writing a program called Social Security.pdf
Overview You are tasked with writing a program called Social Security.pdf
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdf
 
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error-   Exception in thread -main- q- Exit java-lang-.pdfHow to fix this error-   Exception in thread -main- q- Exit java-lang-.pdf
How to fix this error- Exception in thread -main- q- Exit java-lang-.pdf
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 

More from Ankitchhabra28

frequency tableSolution frequency table.pdf
 frequency tableSolution frequency table.pdf frequency tableSolution frequency table.pdf
frequency tableSolution frequency table.pdf
Ankitchhabra28
 
ublic class Elevator { private static final String DOWN = down.pdf
  ublic class Elevator {     private static final String DOWN = down.pdf  ublic class Elevator {     private static final String DOWN = down.pdf
ublic class Elevator { private static final String DOWN = down.pdf
Ankitchhabra28
 
[Al+] [OH-]^3 = Ksp0.2 [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
[Al+]  [OH-]^3 = Ksp0.2  [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf[Al+]  [OH-]^3 = Ksp0.2  [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
[Al+] [OH-]^3 = Ksp0.2 [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
Ankitchhabra28
 
As a CFO environment of internal control needs to put in place t.pdf
    As a CFO environment of internal control needs to put in   place t.pdf    As a CFO environment of internal control needs to put in   place t.pdf
As a CFO environment of internal control needs to put in place t.pdf
Ankitchhabra28
 
What are the financial markets and what purposes do they serveA f.pdf
What are the financial markets and what purposes do they serveA f.pdfWhat are the financial markets and what purposes do they serveA f.pdf
What are the financial markets and what purposes do they serveA f.pdf
Ankitchhabra28
 
VI) Instruction set Architecture-      Instruction set is a colle.pdf
VI) Instruction set Architecture-      Instruction set is a colle.pdfVI) Instruction set Architecture-      Instruction set is a colle.pdf
VI) Instruction set Architecture-      Instruction set is a colle.pdf
Ankitchhabra28
 
waitSolutionwait.pdf
waitSolutionwait.pdfwaitSolutionwait.pdf
waitSolutionwait.pdf
Ankitchhabra28
 
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdfThe OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
Ankitchhabra28
 
the following statements are true Ubiquinone is a small, hydrophob.pdf
the following statements are true Ubiquinone is a small, hydrophob.pdfthe following statements are true Ubiquinone is a small, hydrophob.pdf
the following statements are true Ubiquinone is a small, hydrophob.pdf
Ankitchhabra28
 
The evolution of one species is driven by the evolution of the other.pdf
The evolution of one species is driven by the evolution of the other.pdfThe evolution of one species is driven by the evolution of the other.pdf
The evolution of one species is driven by the evolution of the other.pdf
Ankitchhabra28
 
Student choosed wrong subject. Question was not showning.Solutio.pdf
Student choosed wrong subject. Question was not showning.Solutio.pdfStudent choosed wrong subject. Question was not showning.Solutio.pdf
Student choosed wrong subject. Question was not showning.Solutio.pdf
Ankitchhabra28
 
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdfS(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
Ankitchhabra28
 
Question not visible..please post the imageSolutionQuestion no.pdf
Question not visible..please post the imageSolutionQuestion no.pdfQuestion not visible..please post the imageSolutionQuestion no.pdf
Question not visible..please post the imageSolutionQuestion no.pdf
Ankitchhabra28
 
Program 1 public class QueueUsingArray { private static final i.pdf
Program 1 public class QueueUsingArray { private static final i.pdfProgram 1 public class QueueUsingArray { private static final i.pdf
Program 1 public class QueueUsingArray { private static final i.pdf
Ankitchhabra28
 
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdfPrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
Ankitchhabra28
 
opps no format is there...Solutionopps no format is there....pdf
opps no format is there...Solutionopps no format is there....pdfopps no format is there...Solutionopps no format is there....pdf
opps no format is there...Solutionopps no format is there....pdf
Ankitchhabra28
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdf
Ankitchhabra28
 
No, weight is not the measure of quantity of matter.Quantity of ma.pdf
No, weight is not the measure of quantity of matter.Quantity of ma.pdfNo, weight is not the measure of quantity of matter.Quantity of ma.pdf
No, weight is not the measure of quantity of matter.Quantity of ma.pdf
Ankitchhabra28
 
Two. The pyruvate with carbons 4-6 will go throu.pdf
                     Two.  The pyruvate with carbons 4-6 will go throu.pdf                     Two.  The pyruvate with carbons 4-6 will go throu.pdf
Two. The pyruvate with carbons 4-6 will go throu.pdf
Ankitchhabra28
 
is rightSolutionis right.pdf
is rightSolutionis right.pdfis rightSolutionis right.pdf
is rightSolutionis right.pdf
Ankitchhabra28
 

More from Ankitchhabra28 (20)

frequency tableSolution frequency table.pdf
 frequency tableSolution frequency table.pdf frequency tableSolution frequency table.pdf
frequency tableSolution frequency table.pdf
 
ublic class Elevator { private static final String DOWN = down.pdf
  ublic class Elevator {     private static final String DOWN = down.pdf  ublic class Elevator {     private static final String DOWN = down.pdf
ublic class Elevator { private static final String DOWN = down.pdf
 
[Al+] [OH-]^3 = Ksp0.2 [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
[Al+]  [OH-]^3 = Ksp0.2  [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf[Al+]  [OH-]^3 = Ksp0.2  [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
[Al+] [OH-]^3 = Ksp0.2 [OH-]^3 = 210^-32[OH-] = 4.64210^-1.pdf
 
As a CFO environment of internal control needs to put in place t.pdf
    As a CFO environment of internal control needs to put in   place t.pdf    As a CFO environment of internal control needs to put in   place t.pdf
As a CFO environment of internal control needs to put in place t.pdf
 
What are the financial markets and what purposes do they serveA f.pdf
What are the financial markets and what purposes do they serveA f.pdfWhat are the financial markets and what purposes do they serveA f.pdf
What are the financial markets and what purposes do they serveA f.pdf
 
VI) Instruction set Architecture-      Instruction set is a colle.pdf
VI) Instruction set Architecture-      Instruction set is a colle.pdfVI) Instruction set Architecture-      Instruction set is a colle.pdf
VI) Instruction set Architecture-      Instruction set is a colle.pdf
 
waitSolutionwait.pdf
waitSolutionwait.pdfwaitSolutionwait.pdf
waitSolutionwait.pdf
 
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdfThe OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
The OSI(Open System Interconnection) contains 7 layers.1.Physica.pdf
 
the following statements are true Ubiquinone is a small, hydrophob.pdf
the following statements are true Ubiquinone is a small, hydrophob.pdfthe following statements are true Ubiquinone is a small, hydrophob.pdf
the following statements are true Ubiquinone is a small, hydrophob.pdf
 
The evolution of one species is driven by the evolution of the other.pdf
The evolution of one species is driven by the evolution of the other.pdfThe evolution of one species is driven by the evolution of the other.pdf
The evolution of one species is driven by the evolution of the other.pdf
 
Student choosed wrong subject. Question was not showning.Solutio.pdf
Student choosed wrong subject. Question was not showning.Solutio.pdfStudent choosed wrong subject. Question was not showning.Solutio.pdf
Student choosed wrong subject. Question was not showning.Solutio.pdf
 
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdfS(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
S(sulfur) atom Glucose molecule and compound Oxygen atom DN.pdf
 
Question not visible..please post the imageSolutionQuestion no.pdf
Question not visible..please post the imageSolutionQuestion no.pdfQuestion not visible..please post the imageSolutionQuestion no.pdf
Question not visible..please post the imageSolutionQuestion no.pdf
 
Program 1 public class QueueUsingArray { private static final i.pdf
Program 1 public class QueueUsingArray { private static final i.pdfProgram 1 public class QueueUsingArray { private static final i.pdf
Program 1 public class QueueUsingArray { private static final i.pdf
 
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdfPrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
 
opps no format is there...Solutionopps no format is there....pdf
opps no format is there...Solutionopps no format is there....pdfopps no format is there...Solutionopps no format is there....pdf
opps no format is there...Solutionopps no format is there....pdf
 
Note             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdfNote             Given Code modified as required and required met.pdf
Note             Given Code modified as required and required met.pdf
 
No, weight is not the measure of quantity of matter.Quantity of ma.pdf
No, weight is not the measure of quantity of matter.Quantity of ma.pdfNo, weight is not the measure of quantity of matter.Quantity of ma.pdf
No, weight is not the measure of quantity of matter.Quantity of ma.pdf
 
Two. The pyruvate with carbons 4-6 will go throu.pdf
                     Two.  The pyruvate with carbons 4-6 will go throu.pdf                     Two.  The pyruvate with carbons 4-6 will go throu.pdf
Two. The pyruvate with carbons 4-6 will go throu.pdf
 
is rightSolutionis right.pdf
is rightSolutionis right.pdfis rightSolutionis right.pdf
is rightSolutionis right.pdf
 

Recently uploaded

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 

Recently uploaded (20)

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 

Listing.javaimport java.util.Scanner;public class Listing {   .pdf

  • 1. Listing.java import java.util.Scanner; public class Listing { //Declaring instance variables private String name; private int age; //Default constructor public Listing() { name=" "; age=0; } //parameterized Constructor public Listing(String name, int age) { super(); this.name = name; this.age = age; } //Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } //This input() method will take the inputs entered by the user. public void input()
  • 2. { //Scanner Object is used to get the data entered by the user Scanner sc=new Scanner(System.in); //Getting the user name System.out.print("Enter Name :"); setName(sc.nextLine()); //Getting the Age System.out.print("Enter Age :"); setAge(sc.nextInt()); } //This toString() method will displays the constents of the user. @Override public String toString() { System.out.println("Name :"+getName()); System.out.println("Name :"+getAge()); return ""; } } _____________________________________________________________ Driver.java public class Driver { public static void main(String[] args) { //Create an array of 3 Listing Objects Listing listing[]=new Listing[3]; //Creating Listing Objects and populating into an Array for(int i=0;i<3;i++) { listing[i]=new Listing(); System.out.println("Listing Object "+(i+1)+":"); //Calling the input method which capture the data entered by the user
  • 3. listing[i].input(); } //Displaying the Listing objects in the Normal Order System.out.println("Displaying the Listing Objects in the Normal Order ::"); for(int i=0;i<3;i++) { System.out.println("Listing Object "+(i+1)+":"); listing[i].toString(); System.out.println("_____________________"); } //Displaying the Listing objects in the Reverse Order System.out.println("Displaying the Listing Objects in the Reverse Order ::"); for(int i=2;i>=0;i--) { System.out.println("Listing Object "+(i+1)+":"); listing[i].toString(); System.out.println("_____________________"); } } } _______________________________________________________ Output: Listing Object 1: Enter Name :Kane Williams Enter Age :27 Listing Object 2: Enter Name :John Mills Enter Age :23 Listing Object 3: Enter Name :Tim Rochey Enter Age :22 Displaying the Listing Objects in the Normal Order :: Listing Object 1:
  • 4. Name :Kane Williams Name :27 _____________________ Listing Object 2: Name :John Mills Name :23 _____________________ Listing Object 3: Name :Tim Rochey Name :22 _____________________ Displaying the Listing Objects in the Reverse Order :: Listing Object 3: Name :Tim Rochey Name :22 _____________________ Listing Object 2: Name :John Mills Name :23 _____________________ Listing Object 1: Name :Kane Williams Name :27 _____________________ _____________________________________________Thank You Solution Listing.java import java.util.Scanner; public class Listing { //Declaring instance variables private String name; private int age; //Default constructor
  • 5. public Listing() { name=" "; age=0; } //parameterized Constructor public Listing(String name, int age) { super(); this.name = name; this.age = age; } //Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } //This input() method will take the inputs entered by the user. public void input() { //Scanner Object is used to get the data entered by the user Scanner sc=new Scanner(System.in); //Getting the user name System.out.print("Enter Name :"); setName(sc.nextLine()); //Getting the Age
  • 6. System.out.print("Enter Age :"); setAge(sc.nextInt()); } //This toString() method will displays the constents of the user. @Override public String toString() { System.out.println("Name :"+getName()); System.out.println("Name :"+getAge()); return ""; } } _____________________________________________________________ Driver.java public class Driver { public static void main(String[] args) { //Create an array of 3 Listing Objects Listing listing[]=new Listing[3]; //Creating Listing Objects and populating into an Array for(int i=0;i<3;i++) { listing[i]=new Listing(); System.out.println("Listing Object "+(i+1)+":"); //Calling the input method which capture the data entered by the user listing[i].input(); } //Displaying the Listing objects in the Normal Order System.out.println("Displaying the Listing Objects in the Normal Order ::"); for(int i=0;i<3;i++) { System.out.println("Listing Object "+(i+1)+":"); listing[i].toString();
  • 7. System.out.println("_____________________"); } //Displaying the Listing objects in the Reverse Order System.out.println("Displaying the Listing Objects in the Reverse Order ::"); for(int i=2;i>=0;i--) { System.out.println("Listing Object "+(i+1)+":"); listing[i].toString(); System.out.println("_____________________"); } } } _______________________________________________________ Output: Listing Object 1: Enter Name :Kane Williams Enter Age :27 Listing Object 2: Enter Name :John Mills Enter Age :23 Listing Object 3: Enter Name :Tim Rochey Enter Age :22 Displaying the Listing Objects in the Normal Order :: Listing Object 1: Name :Kane Williams Name :27 _____________________ Listing Object 2: Name :John Mills Name :23 _____________________ Listing Object 3: Name :Tim Rochey
  • 8. Name :22 _____________________ Displaying the Listing Objects in the Reverse Order :: Listing Object 3: Name :Tim Rochey Name :22 _____________________ Listing Object 2: Name :John Mills Name :23 _____________________ Listing Object 1: Name :Kane Williams Name :27 _____________________ _____________________________________________Thank You