SlideShare a Scribd company logo
public class Party {
private int guests;
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests
* the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
import java.util.Scanner;
public class UseParty {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
}
}
public class DinnerParty extends Party {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
}
import java.util.Scanner;
public class UseDinnerParty {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
int choice;
Scanner keyboard = new Scanner(System.in);
DinnerParty aDinnerParty = new DinnerParty();
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
System.out.print("Enter number of guests for the dinner party>> ");
guests = keyboard.nextInt();
aDinnerParty.setGuests(guests);
System.out
.print("Enter the menu option-1 for children or 2 for beef >> ");
choice = keyboard.nextInt();
aDinnerParty.setDinnerChoice(choice);
System.out.println("The dinner party has " + aDinnerParty.getGuests());
System.out.println("menu option " + aDinnerParty.getDinnerChoice()
+ " will be served");
aDinnerParty.displayInvitation();
}
}
public class DinnerParty2 extends Party {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}
import java.util.Scanner;
public class UseDinnerParty2 {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
int choice;
Scanner keyboard = new Scanner(System.in);
DinnerParty2 aDinnerParty = new DinnerParty2();
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
System.out.print("Enter number of guests for the dinner party>> ");
guests = keyboard.nextInt();
aDinnerParty.setGuests(guests);
System.out
.print("Enter the menu option-1 for children or 2 for beef >> ");
choice = keyboard.nextInt();
aDinnerParty.setDinnerChoice(choice);
System.out.println("The dinner party has " + aDinnerParty.getGuests());
System.out.println("menu option " + aDinnerParty.getDinnerChoice()
+ " will be served");
aDinnerParty.displayInvitation();
}
}
public class PartyWithConstructor {
int guests;
public PartyWithConstructor() {
System.out.println("Creating a Party");
}
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
public class DinnerPartyWithConstructor extends PartyWithConstructor {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}
public class useDinnerPartyWithConstructor {
public static void main(String[] arg) {
DinnerPartyWithConstructor aDinnerParty = new DinnerPartyWithConstructor();
}
}
public class PartyWithConstructor2 {
int guests;
public PartyWithConstructor2(int guests) {
this.guests=guests;
}
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
public class DinnerPartyWithConstructor2 extends PartyWithConstructor2 {
private int dinnerChoice;
public DinnerPartyWithConstructor2(int numGuests) {
super(numGuests);
}
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}
Solution
public class Party {
private int guests;
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests
* the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
import java.util.Scanner;
public class UseParty {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
}
}
public class DinnerParty extends Party {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
}
import java.util.Scanner;
public class UseDinnerParty {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
int choice;
Scanner keyboard = new Scanner(System.in);
DinnerParty aDinnerParty = new DinnerParty();
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
System.out.print("Enter number of guests for the dinner party>> ");
guests = keyboard.nextInt();
aDinnerParty.setGuests(guests);
System.out
.print("Enter the menu option-1 for children or 2 for beef >> ");
choice = keyboard.nextInt();
aDinnerParty.setDinnerChoice(choice);
System.out.println("The dinner party has " + aDinnerParty.getGuests());
System.out.println("menu option " + aDinnerParty.getDinnerChoice()
+ " will be served");
aDinnerParty.displayInvitation();
}
}
public class DinnerParty2 extends Party {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}
import java.util.Scanner;
public class UseDinnerParty2 {
public static void main(String[] args) {
Party aParty = new Party();
int guests;
int choice;
Scanner keyboard = new Scanner(System.in);
DinnerParty2 aDinnerParty = new DinnerParty2();
System.out.print("Enter number of guests for the party.>>");
guests = keyboard.nextInt();
aParty.setGuests(guests);
System.out.println("The party has " + aParty.getGuests() + " guest");
aParty.displayInvitation();
System.out.print("Enter number of guests for the dinner party>> ");
guests = keyboard.nextInt();
aDinnerParty.setGuests(guests);
System.out
.print("Enter the menu option-1 for children or 2 for beef >> ");
choice = keyboard.nextInt();
aDinnerParty.setDinnerChoice(choice);
System.out.println("The dinner party has " + aDinnerParty.getGuests());
System.out.println("menu option " + aDinnerParty.getDinnerChoice()
+ " will be served");
aDinnerParty.displayInvitation();
}
}
public class PartyWithConstructor {
int guests;
public PartyWithConstructor() {
System.out.println("Creating a Party");
}
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
public class DinnerPartyWithConstructor extends PartyWithConstructor {
private int dinnerChoice;
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}
public class useDinnerPartyWithConstructor {
public static void main(String[] arg) {
DinnerPartyWithConstructor aDinnerParty = new DinnerPartyWithConstructor();
}
}
public class PartyWithConstructor2 {
int guests;
public PartyWithConstructor2(int guests) {
this.guests=guests;
}
/**
* return the guests
*/
public int getGuests() {
return guests;
}
/**
* param guests the guests to set
*/
public void setGuests(int guests) {
this.guests = guests;
}
public void displayInvitation() {
System.out.println("Please come to my party");
}
}
public class DinnerPartyWithConstructor2 extends PartyWithConstructor2 {
private int dinnerChoice;
public DinnerPartyWithConstructor2(int numGuests) {
super(numGuests);
}
/**
* return the dinnerChoice
*/
public int getDinnerChoice() {
return dinnerChoice;
}
/**
* param dinnerChoice
* the dinnerChoice to set
*/
public void setDinnerChoice(int dinnerChoice) {
this.dinnerChoice = dinnerChoice;
}
public void displayInvitation() {
System.out.println("Please come to my dinner party");
}
}

More Related Content

More from noelbuddy

11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
noelbuddy
 
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
noelbuddy
 
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
noelbuddy
 
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
noelbuddy
 
just hit the ln button sorry guys .pdf
                     just hit the ln button sorry guys                .pdf                     just hit the ln button sorry guys                .pdf
just hit the ln button sorry guys .pdf
noelbuddy
 
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
noelbuddy
 
#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf
noelbuddy
 
Yes. You can prove it experimentally, but if you.pdf
                     Yes.  You can prove it experimentally, but if you.pdf                     Yes.  You can prove it experimentally, but if you.pdf
Yes. You can prove it experimentally, but if you.pdf
noelbuddy
 
the one which is oxidized is reducing agent Pb wa.pdf
                     the one which is oxidized is reducing agent Pb wa.pdf                     the one which is oxidized is reducing agent Pb wa.pdf
the one which is oxidized is reducing agent Pb wa.pdf
noelbuddy
 
   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf
noelbuddy
 
What inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdfWhat inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdf
noelbuddy
 
The tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdfThe tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdf
noelbuddy
 
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdfThe main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
noelbuddy
 
The motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdfThe motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdf
noelbuddy
 
The formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdfThe formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdf
noelbuddy
 
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
noelbuddy
 
D is correct. Solution D .pdf
                     D is correct. Solution                     D .pdf                     D is correct. Solution                     D .pdf
D is correct. Solution D .pdf
noelbuddy
 
doesnt work since S in SO3 is +6 oxidation stat.pdf
                     doesnt work since S in SO3 is +6 oxidation stat.pdf                     doesnt work since S in SO3 is +6 oxidation stat.pdf
doesnt work since S in SO3 is +6 oxidation stat.pdf
noelbuddy
 
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdftan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
noelbuddy
 
SolutionThe most abundant elements in the Earths crust are oxyg.pdf
SolutionThe most abundant elements in the Earths crust are oxyg.pdfSolutionThe most abundant elements in the Earths crust are oxyg.pdf
SolutionThe most abundant elements in the Earths crust are oxyg.pdf
noelbuddy
 

More from noelbuddy (20)

11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
 
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
 
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
 
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
 
just hit the ln button sorry guys .pdf
                     just hit the ln button sorry guys                .pdf                     just hit the ln button sorry guys                .pdf
just hit the ln button sorry guys .pdf
 
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
 
#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf
 
Yes. You can prove it experimentally, but if you.pdf
                     Yes.  You can prove it experimentally, but if you.pdf                     Yes.  You can prove it experimentally, but if you.pdf
Yes. You can prove it experimentally, but if you.pdf
 
the one which is oxidized is reducing agent Pb wa.pdf
                     the one which is oxidized is reducing agent Pb wa.pdf                     the one which is oxidized is reducing agent Pb wa.pdf
the one which is oxidized is reducing agent Pb wa.pdf
 
   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf
 
What inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdfWhat inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdf
 
The tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdfThe tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdf
 
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdfThe main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
 
The motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdfThe motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdf
 
The formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdfThe formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdf
 
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
 
D is correct. Solution D .pdf
                     D is correct. Solution                     D .pdf                     D is correct. Solution                     D .pdf
D is correct. Solution D .pdf
 
doesnt work since S in SO3 is +6 oxidation stat.pdf
                     doesnt work since S in SO3 is +6 oxidation stat.pdf                     doesnt work since S in SO3 is +6 oxidation stat.pdf
doesnt work since S in SO3 is +6 oxidation stat.pdf
 
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdftan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
tan(x) = 2 , 0x 90degcosx = 1sqrt5sinx =2sqrt5Usinf the tr.pdf
 
SolutionThe most abundant elements in the Earths crust are oxyg.pdf
SolutionThe most abundant elements in the Earths crust are oxyg.pdfSolutionThe most abundant elements in the Earths crust are oxyg.pdf
SolutionThe most abundant elements in the Earths crust are oxyg.pdf
 

Recently uploaded

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
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
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
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
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 

Recently uploaded (20)

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
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
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
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
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 

public class Party {    private int guests;      return .pdf

  • 1. public class Party { private int guests; /** * return the guests */ public int getGuests() { return guests; } /** * param guests * the guests to set */ public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party"); } } import java.util.Scanner; public class UseParty { public static void main(String[] args) { Party aParty = new Party(); int guests; Scanner keyboard = new Scanner(System.in); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); } } public class DinnerParty extends Party { private int dinnerChoice; /**
  • 2. * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } } import java.util.Scanner; public class UseDinnerParty { public static void main(String[] args) { Party aParty = new Party(); int guests; int choice; Scanner keyboard = new Scanner(System.in); DinnerParty aDinnerParty = new DinnerParty(); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); System.out.print("Enter number of guests for the dinner party>> "); guests = keyboard.nextInt(); aDinnerParty.setGuests(guests); System.out .print("Enter the menu option-1 for children or 2 for beef >> "); choice = keyboard.nextInt(); aDinnerParty.setDinnerChoice(choice); System.out.println("The dinner party has " + aDinnerParty.getGuests()); System.out.println("menu option " + aDinnerParty.getDinnerChoice() + " will be served");
  • 3. aDinnerParty.displayInvitation(); } } public class DinnerParty2 extends Party { private int dinnerChoice; /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } } import java.util.Scanner; public class UseDinnerParty2 { public static void main(String[] args) { Party aParty = new Party(); int guests; int choice; Scanner keyboard = new Scanner(System.in); DinnerParty2 aDinnerParty = new DinnerParty2(); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); System.out.print("Enter number of guests for the dinner party>> ");
  • 4. guests = keyboard.nextInt(); aDinnerParty.setGuests(guests); System.out .print("Enter the menu option-1 for children or 2 for beef >> "); choice = keyboard.nextInt(); aDinnerParty.setDinnerChoice(choice); System.out.println("The dinner party has " + aDinnerParty.getGuests()); System.out.println("menu option " + aDinnerParty.getDinnerChoice() + " will be served"); aDinnerParty.displayInvitation(); } } public class PartyWithConstructor { int guests; public PartyWithConstructor() { System.out.println("Creating a Party"); } /** * return the guests */ public int getGuests() { return guests; } /** * param guests the guests to set */ public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party"); } } public class DinnerPartyWithConstructor extends PartyWithConstructor { private int dinnerChoice;
  • 5. /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } } public class useDinnerPartyWithConstructor { public static void main(String[] arg) { DinnerPartyWithConstructor aDinnerParty = new DinnerPartyWithConstructor(); } } public class PartyWithConstructor2 { int guests; public PartyWithConstructor2(int guests) { this.guests=guests; } /** * return the guests */ public int getGuests() { return guests; } /** * param guests the guests to set */
  • 6. public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party"); } } public class DinnerPartyWithConstructor2 extends PartyWithConstructor2 { private int dinnerChoice; public DinnerPartyWithConstructor2(int numGuests) { super(numGuests); } /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } } Solution public class Party { private int guests; /** * return the guests
  • 7. */ public int getGuests() { return guests; } /** * param guests * the guests to set */ public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party"); } } import java.util.Scanner; public class UseParty { public static void main(String[] args) { Party aParty = new Party(); int guests; Scanner keyboard = new Scanner(System.in); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); } } public class DinnerParty extends Party { private int dinnerChoice; /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; }
  • 8. /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } } import java.util.Scanner; public class UseDinnerParty { public static void main(String[] args) { Party aParty = new Party(); int guests; int choice; Scanner keyboard = new Scanner(System.in); DinnerParty aDinnerParty = new DinnerParty(); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); System.out.print("Enter number of guests for the dinner party>> "); guests = keyboard.nextInt(); aDinnerParty.setGuests(guests); System.out .print("Enter the menu option-1 for children or 2 for beef >> "); choice = keyboard.nextInt(); aDinnerParty.setDinnerChoice(choice); System.out.println("The dinner party has " + aDinnerParty.getGuests()); System.out.println("menu option " + aDinnerParty.getDinnerChoice() + " will be served"); aDinnerParty.displayInvitation(); } } public class DinnerParty2 extends Party { private int dinnerChoice;
  • 9. /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } } import java.util.Scanner; public class UseDinnerParty2 { public static void main(String[] args) { Party aParty = new Party(); int guests; int choice; Scanner keyboard = new Scanner(System.in); DinnerParty2 aDinnerParty = new DinnerParty2(); System.out.print("Enter number of guests for the party.>>"); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guest"); aParty.displayInvitation(); System.out.print("Enter number of guests for the dinner party>> "); guests = keyboard.nextInt(); aDinnerParty.setGuests(guests); System.out .print("Enter the menu option-1 for children or 2 for beef >> "); choice = keyboard.nextInt();
  • 10. aDinnerParty.setDinnerChoice(choice); System.out.println("The dinner party has " + aDinnerParty.getGuests()); System.out.println("menu option " + aDinnerParty.getDinnerChoice() + " will be served"); aDinnerParty.displayInvitation(); } } public class PartyWithConstructor { int guests; public PartyWithConstructor() { System.out.println("Creating a Party"); } /** * return the guests */ public int getGuests() { return guests; } /** * param guests the guests to set */ public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party"); } } public class DinnerPartyWithConstructor extends PartyWithConstructor { private int dinnerChoice; /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice;
  • 11. } /** * param dinnerChoice the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } } public class useDinnerPartyWithConstructor { public static void main(String[] arg) { DinnerPartyWithConstructor aDinnerParty = new DinnerPartyWithConstructor(); } } public class PartyWithConstructor2 { int guests; public PartyWithConstructor2(int guests) { this.guests=guests; } /** * return the guests */ public int getGuests() { return guests; } /** * param guests the guests to set */ public void setGuests(int guests) { this.guests = guests; } public void displayInvitation() { System.out.println("Please come to my party");
  • 12. } } public class DinnerPartyWithConstructor2 extends PartyWithConstructor2 { private int dinnerChoice; public DinnerPartyWithConstructor2(int numGuests) { super(numGuests); } /** * return the dinnerChoice */ public int getDinnerChoice() { return dinnerChoice; } /** * param dinnerChoice * the dinnerChoice to set */ public void setDinnerChoice(int dinnerChoice) { this.dinnerChoice = dinnerChoice; } public void displayInvitation() { System.out.println("Please come to my dinner party"); } }