SlideShare a Scribd company logo
Vehicle.java
public class Vehicle
{
//Declaring instance variables
private int max_no_passengers;
private int top_speed;
private double miles_travelled;
//Parameterized constructor
public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) {
super();
this.max_no_passengers = max_no_passengers;
this.top_speed = top_speed;
this.miles_travelled = miles_travelled;
}
//Getters and setters
public int getMax_no_passengers() {
return max_no_passengers;
}
public void setMax_no_passengers(int max_no_passengers) {
this.max_no_passengers = max_no_passengers;
}
public int getTop_speed() {
return top_speed;
}
public void setTop_speed(int top_speed) {
this.top_speed = top_speed;
}
public double getMiles_travelled() {
return miles_travelled;
}
public void setMiles_travelled(double miles_travelled) {
this.miles_travelled = miles_travelled;
}
/* This getInfor() method returns the information about this vehicle class object
* Params: void
* Return:String
*/
public String getInfo()
{
String str=" Maximum No of Passengers :"+getMax_no_passengers()+
" Top Speed :"+getTop_speed()+
" Total Miles Travelled :"+getMiles_travelled();
return str;
}
}
_____________________________________________
FoodTruck.java
import java.util.ArrayList;
public class FoodTruck extends Vehicle{
//Declaring instance variables
private String name;
private ArrayList menu;
//Parameterized constructor
public FoodTruck(int max_no_passengers, int top_speed,
double miles_travelled, String name, ArrayList menu) {
super(max_no_passengers, top_speed, miles_travelled);
this.name = name;
this.menu = menu;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList getMenu() {
return menu;
}
public void setMenu(ArrayList menu) {
this.menu = menu;
}
/* This getInfor() method returns the information about this Food truck class Object
* And also the information about the Vehicle class Object.
* Params: void
* Return:String
*/
@Override
public String getInfo() {
String str="Food Truck Name : "+name+
" Menu of items : "+menu+super.getInfo();
return str;
}
}
________________________________________________
Test.java
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu1=new ArrayList();
//Adding menu items to the ArrayList
menu1.add("Burger");
menu1.add("Pizza");
menu1.add("Chips");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck1=new FoodTruck(15,100,10000,"Mobile Food Court",menu1);
//Displaying the Truck1 Information.
System.out.println("__________Truck 1 Details__________");
System.out.println(truck1.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu2=new ArrayList();
//Adding menu items to the ArrayList
menu2.add("Tea");
menu2.add("Coffe");
menu2.add("Cool Drinks");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck2=new FoodTruck(10,80,5000,"Drinks Van",menu2);
//Displaying the Truck2 Information.
System.out.println(" __________Truck 2 Details__________");
System.out.println(truck2.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu3=new ArrayList();
//Adding menu items to the ArrayList
menu3.add("ChocoBar");
menu3.add("Black Forest");
menu3.add("Butter Scortch");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck3=new FoodTruck(12,85,15000,"Ice Cream Court",menu3);
//Displaying the Truck3 Information.
System.out.println(" __________Truck 3 Details__________");
System.out.println(truck3.getInfo());
}
}
_____________________________________________
Output:
__________Truck 1 Details__________
Food Truck Name : Mobile Food Court
Menu of items : [Burger, Pizza, Chips]
Maximum No of Passengers :15
Top Speed :100
Total Miles Travelled :10000.0
__________Truck 2 Details__________
Food Truck Name : Drinks Van
Menu of items : [Tea, Coffe, Cool Drinks]
Maximum No of Passengers :10
Top Speed :80
Total Miles Travelled :5000.0
__________Truck 1 Details__________
Food Truck Name : Ice Cream Court
Menu of items : [ChocoBar, Black Forest, Butter Scortch]
Maximum No of Passengers :12
Top Speed :85
Total Miles Travelled :15000.0
_____________________________________________Thank You
Solution
Vehicle.java
public class Vehicle
{
//Declaring instance variables
private int max_no_passengers;
private int top_speed;
private double miles_travelled;
//Parameterized constructor
public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) {
super();
this.max_no_passengers = max_no_passengers;
this.top_speed = top_speed;
this.miles_travelled = miles_travelled;
}
//Getters and setters
public int getMax_no_passengers() {
return max_no_passengers;
}
public void setMax_no_passengers(int max_no_passengers) {
this.max_no_passengers = max_no_passengers;
}
public int getTop_speed() {
return top_speed;
}
public void setTop_speed(int top_speed) {
this.top_speed = top_speed;
}
public double getMiles_travelled() {
return miles_travelled;
}
public void setMiles_travelled(double miles_travelled) {
this.miles_travelled = miles_travelled;
}
/* This getInfor() method returns the information about this vehicle class object
* Params: void
* Return:String
*/
public String getInfo()
{
String str=" Maximum No of Passengers :"+getMax_no_passengers()+
" Top Speed :"+getTop_speed()+
" Total Miles Travelled :"+getMiles_travelled();
return str;
}
}
_____________________________________________
FoodTruck.java
import java.util.ArrayList;
public class FoodTruck extends Vehicle{
//Declaring instance variables
private String name;
private ArrayList menu;
//Parameterized constructor
public FoodTruck(int max_no_passengers, int top_speed,
double miles_travelled, String name, ArrayList menu) {
super(max_no_passengers, top_speed, miles_travelled);
this.name = name;
this.menu = menu;
}
//Getters and setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList getMenu() {
return menu;
}
public void setMenu(ArrayList menu) {
this.menu = menu;
}
/* This getInfor() method returns the information about this Food truck class Object
* And also the information about the Vehicle class Object.
* Params: void
* Return:String
*/
@Override
public String getInfo() {
String str="Food Truck Name : "+name+
" Menu of items : "+menu+super.getInfo();
return str;
}
}
________________________________________________
Test.java
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu1=new ArrayList();
//Adding menu items to the ArrayList
menu1.add("Burger");
menu1.add("Pizza");
menu1.add("Chips");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck1=new FoodTruck(15,100,10000,"Mobile Food Court",menu1);
//Displaying the Truck1 Information.
System.out.println("__________Truck 1 Details__________");
System.out.println(truck1.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu2=new ArrayList();
//Adding menu items to the ArrayList
menu2.add("Tea");
menu2.add("Coffe");
menu2.add("Cool Drinks");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck2=new FoodTruck(10,80,5000,"Drinks Van",menu2);
//Displaying the Truck2 Information.
System.out.println(" __________Truck 2 Details__________");
System.out.println(truck2.getInfo());
//Creating an ArrayList Object which holds List of Menu Items
ArrayList menu3=new ArrayList();
//Adding menu items to the ArrayList
menu3.add("ChocoBar");
menu3.add("Black Forest");
menu3.add("Butter Scortch");
//Creating FoodTruck Object by passing parameters.
FoodTruck truck3=new FoodTruck(12,85,15000,"Ice Cream Court",menu3);
//Displaying the Truck3 Information.
System.out.println(" __________Truck 3 Details__________");
System.out.println(truck3.getInfo());
}
}
_____________________________________________
Output:
__________Truck 1 Details__________
Food Truck Name : Mobile Food Court
Menu of items : [Burger, Pizza, Chips]
Maximum No of Passengers :15
Top Speed :100
Total Miles Travelled :10000.0
__________Truck 2 Details__________
Food Truck Name : Drinks Van
Menu of items : [Tea, Coffe, Cool Drinks]
Maximum No of Passengers :10
Top Speed :80
Total Miles Travelled :5000.0
__________Truck 1 Details__________
Food Truck Name : Ice Cream Court
Menu of items : [ChocoBar, Black Forest, Butter Scortch]
Maximum No of Passengers :12
Top Speed :85
Total Miles Travelled :15000.0
_____________________________________________Thank You

More Related Content

Similar to Vehicle.javapublic class Vehicle {    Declaring instance var.pdf

Chap2 class,objects
Chap2 class,objectsChap2 class,objects
Chap2 class,objects
raksharao
 
Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)
RichardWarburton
 
DotNet Conference: code smells
DotNet Conference: code smellsDotNet Conference: code smells
DotNet Conference: code smells
Fernando Escolar Martínez-Berganza
 
Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
anokhijew
 
import java-util-ArrayList- public class Bus { private String na.pdf
import java-util-ArrayList-   public class Bus {     private String na.pdfimport java-util-ArrayList-   public class Bus {     private String na.pdf
import java-util-ArrayList- public class Bus { private String na.pdf
GordonF2XPatersonh
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
ANGELMARKETINGJAIPUR
 
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdfimport java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
aquacareser
 
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
honey725342
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
Iram Ramrajkar
 
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdfSimple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
fasttracktreding
 
import java.util.ArrayList; import java.util.List; import java.u.pdf
import java.util.ArrayList; import java.util.List; import java.u.pdfimport java.util.ArrayList; import java.util.List; import java.u.pdf
import java.util.ArrayList; import java.util.List; import java.u.pdf
anupamagarud8
 
MenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdfMenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdf
aparnaagenciestvm
 
Don't Make Android Bad... Again
Don't Make Android Bad... AgainDon't Make Android Bad... Again
Don't Make Android Bad... Again
Pedro Vicente
 
Design patterns in the 21st Century
Design patterns in the 21st CenturyDesign patterns in the 21st Century
Design patterns in the 21st CenturySamir Talwar
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
Subhash Chandran
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
fathimafancy
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
Lars Jankowfsky
 

Similar to Vehicle.javapublic class Vehicle {    Declaring instance var.pdf (19)

Chap2 class,objects
Chap2 class,objectsChap2 class,objects
Chap2 class,objects
 
Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)Pragmatic functional refactoring with java 8 (1)
Pragmatic functional refactoring with java 8 (1)
 
DotNet Conference: code smells
DotNet Conference: code smellsDotNet Conference: code smells
DotNet Conference: code smells
 
Code to copy Person.java .pdf
Code to copy Person.java .pdfCode to copy Person.java .pdf
Code to copy Person.java .pdf
 
import java-util-ArrayList- public class Bus { private String na.pdf
import java-util-ArrayList-   public class Bus {     private String na.pdfimport java-util-ArrayList-   public class Bus {     private String na.pdf
import java-util-ArrayList- public class Bus { private String na.pdf
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
 
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdfimport java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
import java.util.Random;ASSIGNMENT #2 MATRIX ARITHMETIC Cla.pdf
 
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx1  MVC – Ajax and Modal Views AJAX stands for Asynch.docx
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docx
 
slides
slidesslides
slides
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdfSimple array Java code.The “Park-a-lot” parking garage currently o.pdf
Simple array Java code.The “Park-a-lot” parking garage currently o.pdf
 
import java.util.ArrayList; import java.util.List; import java.u.pdf
import java.util.ArrayList; import java.util.List; import java.u.pdfimport java.util.ArrayList; import java.util.List; import java.u.pdf
import java.util.ArrayList; import java.util.List; import java.u.pdf
 
MenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdfMenuItemvpublic class MenuItem .pdf
MenuItemvpublic class MenuItem .pdf
 
Don't Make Android Bad... Again
Don't Make Android Bad... AgainDon't Make Android Bad... Again
Don't Make Android Bad... Again
 
Design patterns in the 21st Century
Design patterns in the 21st CenturyDesign patterns in the 21st Century
Design patterns in the 21st Century
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
ETM Server
ETM ServerETM Server
ETM Server
 

More from anujsharmaanuj14

pH = pKa + log (Sa) where S =moles of salt a = m.pdf
                     pH = pKa + log (Sa) where S =moles of salt a = m.pdf                     pH = pKa + log (Sa) where S =moles of salt a = m.pdf
pH = pKa + log (Sa) where S =moles of salt a = m.pdf
anujsharmaanuj14
 
H is reduced, while Fe is oxidized. Note the oxi.pdf
                     H is reduced, while Fe is oxidized. Note the oxi.pdf                     H is reduced, while Fe is oxidized. Note the oxi.pdf
H is reduced, while Fe is oxidized. Note the oxi.pdf
anujsharmaanuj14
 
Elastic fluids Nonmetals Metals Earths .pdf
                     Elastic fluids  Nonmetals  Metals  Earths        .pdf                     Elastic fluids  Nonmetals  Metals  Earths        .pdf
Elastic fluids Nonmetals Metals Earths .pdf
anujsharmaanuj14
 
Ionization energy is the energy required to remove theouter most ele.pdf
Ionization energy is the energy required to remove theouter most ele.pdfIonization energy is the energy required to remove theouter most ele.pdf
Ionization energy is the energy required to remove theouter most ele.pdf
anujsharmaanuj14
 
D. Both C and N are hybridized sp3 .pdf
                     D. Both C and N are hybridized sp3               .pdf                     D. Both C and N are hybridized sp3               .pdf
D. Both C and N are hybridized sp3 .pdf
anujsharmaanuj14
 
The presence of conjugated Carbon-carbon double bonds causes colorat.pdf
The presence of conjugated Carbon-carbon double bonds causes colorat.pdfThe presence of conjugated Carbon-carbon double bonds causes colorat.pdf
The presence of conjugated Carbon-carbon double bonds causes colorat.pdf
anujsharmaanuj14
 
The amount to be deposited at the start of his studies is found as.pdf
The amount to be deposited at the start of his studies is found as.pdfThe amount to be deposited at the start of his studies is found as.pdf
The amount to be deposited at the start of his studies is found as.pdf
anujsharmaanuj14
 
SolutionNet cash provided by operating activities for the year end.pdf
SolutionNet cash provided by operating activities for the year end.pdfSolutionNet cash provided by operating activities for the year end.pdf
SolutionNet cash provided by operating activities for the year end.pdf
anujsharmaanuj14
 
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdfSOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
anujsharmaanuj14
 
C. 2nd. .pdf
                     C. 2nd.                                      .pdf                     C. 2nd.                                      .pdf
C. 2nd. .pdf
anujsharmaanuj14
 
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdfpH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
anujsharmaanuj14
 
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdfP0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
anujsharmaanuj14
 
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdf
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdfNt = No er twhere density at time tNo= = starting densityNr=dN.pdf
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdf
anujsharmaanuj14
 
Normalization is necessay step in creation of database design becaus.pdf
Normalization is necessay step in creation of database design becaus.pdfNormalization is necessay step in creation of database design becaus.pdf
Normalization is necessay step in creation of database design becaus.pdf
anujsharmaanuj14
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
anujsharmaanuj14
 
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdfFor sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
anujsharmaanuj14
 
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdfExp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
anujsharmaanuj14
 
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdfDNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
anujsharmaanuj14
 
Delta is a measures of the change in price of an option for a one po.pdf
Delta is a measures of the change in price of an option for a one po.pdfDelta is a measures of the change in price of an option for a one po.pdf
Delta is a measures of the change in price of an option for a one po.pdf
anujsharmaanuj14
 
consider the cross between White petals and dark blue petalsFlower.pdf
consider the cross between White petals and dark blue petalsFlower.pdfconsider the cross between White petals and dark blue petalsFlower.pdf
consider the cross between White petals and dark blue petalsFlower.pdf
anujsharmaanuj14
 

More from anujsharmaanuj14 (20)

pH = pKa + log (Sa) where S =moles of salt a = m.pdf
                     pH = pKa + log (Sa) where S =moles of salt a = m.pdf                     pH = pKa + log (Sa) where S =moles of salt a = m.pdf
pH = pKa + log (Sa) where S =moles of salt a = m.pdf
 
H is reduced, while Fe is oxidized. Note the oxi.pdf
                     H is reduced, while Fe is oxidized. Note the oxi.pdf                     H is reduced, while Fe is oxidized. Note the oxi.pdf
H is reduced, while Fe is oxidized. Note the oxi.pdf
 
Elastic fluids Nonmetals Metals Earths .pdf
                     Elastic fluids  Nonmetals  Metals  Earths        .pdf                     Elastic fluids  Nonmetals  Metals  Earths        .pdf
Elastic fluids Nonmetals Metals Earths .pdf
 
Ionization energy is the energy required to remove theouter most ele.pdf
Ionization energy is the energy required to remove theouter most ele.pdfIonization energy is the energy required to remove theouter most ele.pdf
Ionization energy is the energy required to remove theouter most ele.pdf
 
D. Both C and N are hybridized sp3 .pdf
                     D. Both C and N are hybridized sp3               .pdf                     D. Both C and N are hybridized sp3               .pdf
D. Both C and N are hybridized sp3 .pdf
 
The presence of conjugated Carbon-carbon double bonds causes colorat.pdf
The presence of conjugated Carbon-carbon double bonds causes colorat.pdfThe presence of conjugated Carbon-carbon double bonds causes colorat.pdf
The presence of conjugated Carbon-carbon double bonds causes colorat.pdf
 
The amount to be deposited at the start of his studies is found as.pdf
The amount to be deposited at the start of his studies is found as.pdfThe amount to be deposited at the start of his studies is found as.pdf
The amount to be deposited at the start of his studies is found as.pdf
 
SolutionNet cash provided by operating activities for the year end.pdf
SolutionNet cash provided by operating activities for the year end.pdfSolutionNet cash provided by operating activities for the year end.pdf
SolutionNet cash provided by operating activities for the year end.pdf
 
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdfSOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
SOA ( Service Oriented Architecture)SOA is a type of architectura.pdf
 
C. 2nd. .pdf
                     C. 2nd.                                      .pdf                     C. 2nd.                                      .pdf
C. 2nd. .pdf
 
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdfpH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
pH= -log(1x10-8)= 8SolutionpH= -log(1x10-8)= 8.pdf
 
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdfP0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
P0 = 21.40D1 = 1.07D2 =1.1449D3 = 1.2250P3 = 26.22Growth r.pdf
 
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdf
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdfNt = No er twhere density at time tNo= = starting densityNr=dN.pdf
Nt = No er twhere density at time tNo= = starting densityNr=dN.pdf
 
Normalization is necessay step in creation of database design becaus.pdf
Normalization is necessay step in creation of database design becaus.pdfNormalization is necessay step in creation of database design becaus.pdf
Normalization is necessay step in creation of database design becaus.pdf
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
 
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdfFor sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
For sound intensity,ratio in dB is given byx = 10log(IIo)We.pdf
 
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdfExp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
Exp- Listeria monocytogenes is a facultative anaerobic bacteria tha.pdf
 
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdfDNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
DNA controversy is a dispute about whether Rosalind Franklin and Wil.pdf
 
Delta is a measures of the change in price of an option for a one po.pdf
Delta is a measures of the change in price of an option for a one po.pdfDelta is a measures of the change in price of an option for a one po.pdf
Delta is a measures of the change in price of an option for a one po.pdf
 
consider the cross between White petals and dark blue petalsFlower.pdf
consider the cross between White petals and dark blue petalsFlower.pdfconsider the cross between White petals and dark blue petalsFlower.pdf
consider the cross between White petals and dark blue petalsFlower.pdf
 

Recently uploaded

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
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
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
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)
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
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
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
"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
 
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
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
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
 
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
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
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
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
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
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
"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...
 
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...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
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...
 
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
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

Vehicle.javapublic class Vehicle {    Declaring instance var.pdf

  • 1. Vehicle.java public class Vehicle { //Declaring instance variables private int max_no_passengers; private int top_speed; private double miles_travelled; //Parameterized constructor public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) { super(); this.max_no_passengers = max_no_passengers; this.top_speed = top_speed; this.miles_travelled = miles_travelled; } //Getters and setters public int getMax_no_passengers() { return max_no_passengers; } public void setMax_no_passengers(int max_no_passengers) { this.max_no_passengers = max_no_passengers; } public int getTop_speed() { return top_speed; } public void setTop_speed(int top_speed) { this.top_speed = top_speed; } public double getMiles_travelled() { return miles_travelled; } public void setMiles_travelled(double miles_travelled) { this.miles_travelled = miles_travelled; }
  • 2. /* This getInfor() method returns the information about this vehicle class object * Params: void * Return:String */ public String getInfo() { String str=" Maximum No of Passengers :"+getMax_no_passengers()+ " Top Speed :"+getTop_speed()+ " Total Miles Travelled :"+getMiles_travelled(); return str; } } _____________________________________________ FoodTruck.java import java.util.ArrayList; public class FoodTruck extends Vehicle{ //Declaring instance variables private String name; private ArrayList menu; //Parameterized constructor public FoodTruck(int max_no_passengers, int top_speed, double miles_travelled, String name, ArrayList menu) { super(max_no_passengers, top_speed, miles_travelled); this.name = name; this.menu = menu; } //Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public ArrayList getMenu() {
  • 3. return menu; } public void setMenu(ArrayList menu) { this.menu = menu; } /* This getInfor() method returns the information about this Food truck class Object * And also the information about the Vehicle class Object. * Params: void * Return:String */ @Override public String getInfo() { String str="Food Truck Name : "+name+ " Menu of items : "+menu+super.getInfo(); return str; } } ________________________________________________ Test.java import java.util.ArrayList; public class Test { public static void main(String[] args) { //Creating an ArrayList Object which holds List of Menu Items ArrayList menu1=new ArrayList(); //Adding menu items to the ArrayList menu1.add("Burger"); menu1.add("Pizza"); menu1.add("Chips"); //Creating FoodTruck Object by passing parameters. FoodTruck truck1=new FoodTruck(15,100,10000,"Mobile Food Court",menu1); //Displaying the Truck1 Information.
  • 4. System.out.println("__________Truck 1 Details__________"); System.out.println(truck1.getInfo()); //Creating an ArrayList Object which holds List of Menu Items ArrayList menu2=new ArrayList(); //Adding menu items to the ArrayList menu2.add("Tea"); menu2.add("Coffe"); menu2.add("Cool Drinks"); //Creating FoodTruck Object by passing parameters. FoodTruck truck2=new FoodTruck(10,80,5000,"Drinks Van",menu2); //Displaying the Truck2 Information. System.out.println(" __________Truck 2 Details__________"); System.out.println(truck2.getInfo()); //Creating an ArrayList Object which holds List of Menu Items ArrayList menu3=new ArrayList(); //Adding menu items to the ArrayList menu3.add("ChocoBar"); menu3.add("Black Forest"); menu3.add("Butter Scortch"); //Creating FoodTruck Object by passing parameters. FoodTruck truck3=new FoodTruck(12,85,15000,"Ice Cream Court",menu3); //Displaying the Truck3 Information. System.out.println(" __________Truck 3 Details__________"); System.out.println(truck3.getInfo()); } } _____________________________________________ Output:
  • 5. __________Truck 1 Details__________ Food Truck Name : Mobile Food Court Menu of items : [Burger, Pizza, Chips] Maximum No of Passengers :15 Top Speed :100 Total Miles Travelled :10000.0 __________Truck 2 Details__________ Food Truck Name : Drinks Van Menu of items : [Tea, Coffe, Cool Drinks] Maximum No of Passengers :10 Top Speed :80 Total Miles Travelled :5000.0 __________Truck 1 Details__________ Food Truck Name : Ice Cream Court Menu of items : [ChocoBar, Black Forest, Butter Scortch] Maximum No of Passengers :12 Top Speed :85 Total Miles Travelled :15000.0 _____________________________________________Thank You Solution Vehicle.java public class Vehicle { //Declaring instance variables private int max_no_passengers; private int top_speed; private double miles_travelled; //Parameterized constructor public Vehicle(int max_no_passengers, int top_speed, double miles_travelled) { super(); this.max_no_passengers = max_no_passengers; this.top_speed = top_speed; this.miles_travelled = miles_travelled;
  • 6. } //Getters and setters public int getMax_no_passengers() { return max_no_passengers; } public void setMax_no_passengers(int max_no_passengers) { this.max_no_passengers = max_no_passengers; } public int getTop_speed() { return top_speed; } public void setTop_speed(int top_speed) { this.top_speed = top_speed; } public double getMiles_travelled() { return miles_travelled; } public void setMiles_travelled(double miles_travelled) { this.miles_travelled = miles_travelled; } /* This getInfor() method returns the information about this vehicle class object * Params: void * Return:String */ public String getInfo() { String str=" Maximum No of Passengers :"+getMax_no_passengers()+ " Top Speed :"+getTop_speed()+ " Total Miles Travelled :"+getMiles_travelled(); return str; } } _____________________________________________ FoodTruck.java import java.util.ArrayList;
  • 7. public class FoodTruck extends Vehicle{ //Declaring instance variables private String name; private ArrayList menu; //Parameterized constructor public FoodTruck(int max_no_passengers, int top_speed, double miles_travelled, String name, ArrayList menu) { super(max_no_passengers, top_speed, miles_travelled); this.name = name; this.menu = menu; } //Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public ArrayList getMenu() { return menu; } public void setMenu(ArrayList menu) { this.menu = menu; } /* This getInfor() method returns the information about this Food truck class Object * And also the information about the Vehicle class Object. * Params: void * Return:String */ @Override public String getInfo() { String str="Food Truck Name : "+name+ " Menu of items : "+menu+super.getInfo(); return str;
  • 8. } } ________________________________________________ Test.java import java.util.ArrayList; public class Test { public static void main(String[] args) { //Creating an ArrayList Object which holds List of Menu Items ArrayList menu1=new ArrayList(); //Adding menu items to the ArrayList menu1.add("Burger"); menu1.add("Pizza"); menu1.add("Chips"); //Creating FoodTruck Object by passing parameters. FoodTruck truck1=new FoodTruck(15,100,10000,"Mobile Food Court",menu1); //Displaying the Truck1 Information. System.out.println("__________Truck 1 Details__________"); System.out.println(truck1.getInfo()); //Creating an ArrayList Object which holds List of Menu Items ArrayList menu2=new ArrayList(); //Adding menu items to the ArrayList menu2.add("Tea"); menu2.add("Coffe"); menu2.add("Cool Drinks"); //Creating FoodTruck Object by passing parameters. FoodTruck truck2=new FoodTruck(10,80,5000,"Drinks Van",menu2); //Displaying the Truck2 Information.
  • 9. System.out.println(" __________Truck 2 Details__________"); System.out.println(truck2.getInfo()); //Creating an ArrayList Object which holds List of Menu Items ArrayList menu3=new ArrayList(); //Adding menu items to the ArrayList menu3.add("ChocoBar"); menu3.add("Black Forest"); menu3.add("Butter Scortch"); //Creating FoodTruck Object by passing parameters. FoodTruck truck3=new FoodTruck(12,85,15000,"Ice Cream Court",menu3); //Displaying the Truck3 Information. System.out.println(" __________Truck 3 Details__________"); System.out.println(truck3.getInfo()); } } _____________________________________________ Output: __________Truck 1 Details__________ Food Truck Name : Mobile Food Court Menu of items : [Burger, Pizza, Chips] Maximum No of Passengers :15 Top Speed :100 Total Miles Travelled :10000.0 __________Truck 2 Details__________ Food Truck Name : Drinks Van Menu of items : [Tea, Coffe, Cool Drinks] Maximum No of Passengers :10 Top Speed :80 Total Miles Travelled :5000.0 __________Truck 1 Details__________ Food Truck Name : Ice Cream Court Menu of items : [ChocoBar, Black Forest, Butter Scortch]
  • 10. Maximum No of Passengers :12 Top Speed :85 Total Miles Travelled :15000.0 _____________________________________________Thank You