SlideShare a Scribd company logo
1 of 3
Download to read offline
Begin with the InventoryItem class and InventoryDemo front-end that I sent you earlier (JavaIICh9)
that that asks for the description and number of units of an item.:
ublic class InventoryItem
{
private String description; // Item description
private int units; // Units on-hand
public InventoryItem()
{
description = "";
units = 0;
//this("",0);
}
public InventoryItem(String d)
{
description = d;
units = 0;
}
public InventoryItem(String d, int u)
{
description = d;
units = u;
}
public void setDescription(String d)
{
description = d;
}
public void setUnits(int u)
{
units = u;
}
public String getDescription()
{
return description;
}
public int getUnits()
{
return units;
}
}
blic class InventoryDemo
{
public static void main(String[] args)
{
InventoryItem item1 = new InventoryItem();
System.out.println("Item 1:");
System.out.println("Description: "
+ item1.getDescription());
System.out.println("Units: " + item1.getUnits());
System.out.println();
InventoryItem item2 = new InventoryItem("Wrench");
System.out.println("Item 2:");
System.out.println("Description: "
+ item2.getDescription());
System.out.println("Units: " + item2.getUnits());
System.out.println();
InventoryItem item3 = new InventoryItem("Hammer", 20);
System.out.println("Item 3:");
System.out.println("Description: "
+ item3.getDescription());
System.out.println("Units: " + item3.getUnits());
}
}
Write a second class InventoryItem2 which extends InventoryItem and consists of:
Variables for the price of the item and brand name of the item
A constructor which reads in the four values: description, units, price, and brand. Your constructor
should call the super constructor in InventoryItem to set the description and unit variables
Create setters and getters for price and brand name
You can create a toString method which prints out a complete description of the item.
Write a front end called InventoryDemo2 which:
Asks for the description, number of units, price, and brand name of the item.
Creates an instance of InventoryItem2 and passes the values of the four variables.
Then prints out the complete description of the item.
Pass in copies of InventoryItem2 and InventoryDemo2.
The following is an example printout.
run:
Enter the description of the item: Hammer
Enter the number of units on hand: 20
Enter the price of the item: 19.99
Enter the brand name of the item: Smacko
Our Item:
Description: Hammer
Units: 20
Price: 19.99
Brand: Smacko
BUILD SUCCESSFUL (total time: 12 seconds)
For Homework #5
InventoryItem
description
units
Constructor(description,units)
get/set description
get/set units
InventoryItem2 extends InventoryItem
price
brand
Constructor(description,units,price,brand)
get/set price
get/set brand
InventoryItem
description
units
Constructor(description,units)
get/set description
get/set units
InventoryItem2 extends InventoryItem
price
brand
Constructor(description,units,price,brand)
get/set price
get/set brand

More Related Content

Similar to Begin with the InventoryItem class and InventoryDemo fronte.pdf

Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2Kaela Johnson
 
Type level programming in Scala
Type level programming in ScalaType level programming in Scala
Type level programming in ScalaIkhoon Eom
 
ADBMS ASSIGNMENT
ADBMS ASSIGNMENTADBMS ASSIGNMENT
ADBMS ASSIGNMENTLori Moore
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingHock Leng PUAH
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 
It's complicated, but it doesn't have to be: a Dagger journey
It's complicated, but it doesn't have to be: a Dagger journeyIt's complicated, but it doesn't have to be: a Dagger journey
It's complicated, but it doesn't have to be: a Dagger journeyThiago “Fred” Porciúncula
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfoliojlshare
 
Lab exam 5_5_15
Lab exam 5_5_15Lab exam 5_5_15
Lab exam 5_5_15Daman Toor
 
Given main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfGiven main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfillyasraja7
 
Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Poonam Chopra
 
c#(loops,arrays)
c#(loops,arrays)c#(loops,arrays)
c#(loops,arrays)sdrhr
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfflashfashioncasualwe
 
Modify the bouncing ball example demonstrated/tutorialoutlet
Modify the bouncing ball example demonstrated/tutorialoutletModify the bouncing ball example demonstrated/tutorialoutlet
Modify the bouncing ball example demonstrated/tutorialoutletCleasbyz
 
Data Types & Objects .pptx
Data Types & Objects .pptxData Types & Objects .pptx
Data Types & Objects .pptxNayyabMirTahir
 

Similar to Begin with the InventoryItem class and InventoryDemo fronte.pdf (19)

Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
 
Type level programming in Scala
Type level programming in ScalaType level programming in Scala
Type level programming in Scala
 
Clean code slide
Clean code slideClean code slide
Clean code slide
 
ADBMS ASSIGNMENT
ADBMS ASSIGNMENTADBMS ASSIGNMENT
ADBMS ASSIGNMENT
 
Les22
Les22Les22
Les22
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
It's complicated, but it doesn't have to be: a Dagger journey
It's complicated, but it doesn't have to be: a Dagger journeyIt's complicated, but it doesn't have to be: a Dagger journey
It's complicated, but it doesn't have to be: a Dagger journey
 
This is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdfThis is a java lab assignment. I have added the first part java re.pdf
This is a java lab assignment. I have added the first part java re.pdf
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfolio
 
Lab exam 5_5_15
Lab exam 5_5_15Lab exam 5_5_15
Lab exam 5_5_15
 
Given main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdfGiven main() in the Inventory class, define an insertAtFront() metho.pdf
Given main() in the Inventory class, define an insertAtFront() metho.pdf
 
Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Computer Science Sample Paper 2015
Computer Science Sample Paper 2015
 
AWT New-3.pptx
AWT New-3.pptxAWT New-3.pptx
AWT New-3.pptx
 
c#(loops,arrays)
c#(loops,arrays)c#(loops,arrays)
c#(loops,arrays)
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
 
Modify the bouncing ball example demonstrated/tutorialoutlet
Modify the bouncing ball example demonstrated/tutorialoutletModify the bouncing ball example demonstrated/tutorialoutlet
Modify the bouncing ball example demonstrated/tutorialoutlet
 
Notes(1).pptx
Notes(1).pptxNotes(1).pptx
Notes(1).pptx
 
Data Types & Objects .pptx
Data Types & Objects .pptxData Types & Objects .pptx
Data Types & Objects .pptx
 

More from aartienterprises2014

What is the future of cybersecurity including the potential.pdf
What is the future of cybersecurity including the potential.pdfWhat is the future of cybersecurity including the potential.pdf
What is the future of cybersecurity including the potential.pdfaartienterprises2014
 
Which statement about tasks in the implementation phase is N.pdf
Which statement about tasks in the implementation phase is N.pdfWhich statement about tasks in the implementation phase is N.pdf
Which statement about tasks in the implementation phase is N.pdfaartienterprises2014
 
What are the seven steps in the software development process.pdf
What are the seven steps in the software development process.pdfWhat are the seven steps in the software development process.pdf
What are the seven steps in the software development process.pdfaartienterprises2014
 
Which of the following is NOT a major reason that scientific.pdf
Which of the following is NOT a major reason that scientific.pdfWhich of the following is NOT a major reason that scientific.pdf
Which of the following is NOT a major reason that scientific.pdfaartienterprises2014
 
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdf
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdfUN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdf
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdfaartienterprises2014
 
Un ser humano debera poder cambiar un paal planear una i.pdf
Un ser humano debera poder cambiar un paal planear una i.pdfUn ser humano debera poder cambiar un paal planear una i.pdf
Un ser humano debera poder cambiar un paal planear una i.pdfaartienterprises2014
 
Thanks for sharing your perspective in this post Why are ca.pdf
Thanks for sharing your perspective in this post Why are ca.pdfThanks for sharing your perspective in this post Why are ca.pdf
Thanks for sharing your perspective in this post Why are ca.pdfaartienterprises2014
 
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdf
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdfTedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdf
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdfaartienterprises2014
 
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdf
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdfSondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdf
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdfaartienterprises2014
 
rn zellikleri ve benimseme oran balamnda greli avantaj .pdf
rn zellikleri ve benimseme oran balamnda greli avantaj .pdfrn zellikleri ve benimseme oran balamnda greli avantaj .pdf
rn zellikleri ve benimseme oran balamnda greli avantaj .pdfaartienterprises2014
 
RESEARCH METHODS Providing more information compare and co.pdf
RESEARCH METHODS  Providing more information compare and co.pdfRESEARCH METHODS  Providing more information compare and co.pdf
RESEARCH METHODS Providing more information compare and co.pdfaartienterprises2014
 
Serna amp Francis una firma contable utiliza una marca a.pdf
Serna amp Francis una firma contable utiliza una marca a.pdfSerna amp Francis una firma contable utiliza una marca a.pdf
Serna amp Francis una firma contable utiliza una marca a.pdfaartienterprises2014
 
Project Management Module Project Model 2 The great .pdf
Project Management Module Project    Model 2    The great .pdfProject Management Module Project    Model 2    The great .pdf
Project Management Module Project Model 2 The great .pdfaartienterprises2014
 
public boolean FUNint Aint s int howmany int pos s.pdf
public boolean FUNint Aint s int howmany  int pos  s.pdfpublic boolean FUNint Aint s int howmany  int pos  s.pdf
public boolean FUNint Aint s int howmany int pos s.pdfaartienterprises2014
 
Pregunta Quickbooks en lnea Trudies Tea Room desea redu.pdf
Pregunta Quickbooks en lnea  Trudies Tea Room desea redu.pdfPregunta Quickbooks en lnea  Trudies Tea Room desea redu.pdf
Pregunta Quickbooks en lnea Trudies Tea Room desea redu.pdfaartienterprises2014
 
On November 1 2019 Branch Corporation converted a 10000 ac.pdf
On November 1 2019 Branch Corporation converted a 10000 ac.pdfOn November 1 2019 Branch Corporation converted a 10000 ac.pdf
On November 1 2019 Branch Corporation converted a 10000 ac.pdfaartienterprises2014
 
Por favor quiero una respuesta a las preguntas de verdadero .pdf
Por favor quiero una respuesta a las preguntas de verdadero .pdfPor favor quiero una respuesta a las preguntas de verdadero .pdf
Por favor quiero una respuesta a las preguntas de verdadero .pdfaartienterprises2014
 
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdf
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdfPPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdf
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdfaartienterprises2014
 
NIST 800171 32 Awareness and Training 351 Identify syst.pdf
NIST 800171 32 Awareness and Training 351 Identify syst.pdfNIST 800171 32 Awareness and Training 351 Identify syst.pdf
NIST 800171 32 Awareness and Training 351 Identify syst.pdfaartienterprises2014
 
Mientras aumenta su presencia en las redes sociales Oreo co.pdf
Mientras aumenta su presencia en las redes sociales Oreo co.pdfMientras aumenta su presencia en las redes sociales Oreo co.pdf
Mientras aumenta su presencia en las redes sociales Oreo co.pdfaartienterprises2014
 

More from aartienterprises2014 (20)

What is the future of cybersecurity including the potential.pdf
What is the future of cybersecurity including the potential.pdfWhat is the future of cybersecurity including the potential.pdf
What is the future of cybersecurity including the potential.pdf
 
Which statement about tasks in the implementation phase is N.pdf
Which statement about tasks in the implementation phase is N.pdfWhich statement about tasks in the implementation phase is N.pdf
Which statement about tasks in the implementation phase is N.pdf
 
What are the seven steps in the software development process.pdf
What are the seven steps in the software development process.pdfWhat are the seven steps in the software development process.pdf
What are the seven steps in the software development process.pdf
 
Which of the following is NOT a major reason that scientific.pdf
Which of the following is NOT a major reason that scientific.pdfWhich of the following is NOT a major reason that scientific.pdf
Which of the following is NOT a major reason that scientific.pdf
 
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdf
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdfUN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdf
UN ESTUDIO DE CASO PARA UN EJERCICIO DE ANLISIS DE PARTES I.pdf
 
Un ser humano debera poder cambiar un paal planear una i.pdf
Un ser humano debera poder cambiar un paal planear una i.pdfUn ser humano debera poder cambiar un paal planear una i.pdf
Un ser humano debera poder cambiar un paal planear una i.pdf
 
Thanks for sharing your perspective in this post Why are ca.pdf
Thanks for sharing your perspective in this post Why are ca.pdfThanks for sharing your perspective in this post Why are ca.pdf
Thanks for sharing your perspective in this post Why are ca.pdf
 
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdf
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdfTedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdf
Tedarikiler ortaklar mteriler ve rakipler bir kuruluun _.pdf
 
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdf
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdfSondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdf
Sondaj svs S Sondaj svlar laboratuvarnda kullanlan biri pH.pdf
 
rn zellikleri ve benimseme oran balamnda greli avantaj .pdf
rn zellikleri ve benimseme oran balamnda greli avantaj .pdfrn zellikleri ve benimseme oran balamnda greli avantaj .pdf
rn zellikleri ve benimseme oran balamnda greli avantaj .pdf
 
RESEARCH METHODS Providing more information compare and co.pdf
RESEARCH METHODS  Providing more information compare and co.pdfRESEARCH METHODS  Providing more information compare and co.pdf
RESEARCH METHODS Providing more information compare and co.pdf
 
Serna amp Francis una firma contable utiliza una marca a.pdf
Serna amp Francis una firma contable utiliza una marca a.pdfSerna amp Francis una firma contable utiliza una marca a.pdf
Serna amp Francis una firma contable utiliza una marca a.pdf
 
Project Management Module Project Model 2 The great .pdf
Project Management Module Project    Model 2    The great .pdfProject Management Module Project    Model 2    The great .pdf
Project Management Module Project Model 2 The great .pdf
 
public boolean FUNint Aint s int howmany int pos s.pdf
public boolean FUNint Aint s int howmany  int pos  s.pdfpublic boolean FUNint Aint s int howmany  int pos  s.pdf
public boolean FUNint Aint s int howmany int pos s.pdf
 
Pregunta Quickbooks en lnea Trudies Tea Room desea redu.pdf
Pregunta Quickbooks en lnea  Trudies Tea Room desea redu.pdfPregunta Quickbooks en lnea  Trudies Tea Room desea redu.pdf
Pregunta Quickbooks en lnea Trudies Tea Room desea redu.pdf
 
On November 1 2019 Branch Corporation converted a 10000 ac.pdf
On November 1 2019 Branch Corporation converted a 10000 ac.pdfOn November 1 2019 Branch Corporation converted a 10000 ac.pdf
On November 1 2019 Branch Corporation converted a 10000 ac.pdf
 
Por favor quiero una respuesta a las preguntas de verdadero .pdf
Por favor quiero una respuesta a las preguntas de verdadero .pdfPor favor quiero una respuesta a las preguntas de verdadero .pdf
Por favor quiero una respuesta a las preguntas de verdadero .pdf
 
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdf
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdfPPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdf
PPFyi kullanarak uluslararas ticaret modelini tamamlamak i.pdf
 
NIST 800171 32 Awareness and Training 351 Identify syst.pdf
NIST 800171 32 Awareness and Training 351 Identify syst.pdfNIST 800171 32 Awareness and Training 351 Identify syst.pdf
NIST 800171 32 Awareness and Training 351 Identify syst.pdf
 
Mientras aumenta su presencia en las redes sociales Oreo co.pdf
Mientras aumenta su presencia en las redes sociales Oreo co.pdfMientras aumenta su presencia en las redes sociales Oreo co.pdf
Mientras aumenta su presencia en las redes sociales Oreo co.pdf
 

Recently uploaded

MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

Begin with the InventoryItem class and InventoryDemo fronte.pdf

  • 1. Begin with the InventoryItem class and InventoryDemo front-end that I sent you earlier (JavaIICh9) that that asks for the description and number of units of an item.: ublic class InventoryItem { private String description; // Item description private int units; // Units on-hand public InventoryItem() { description = ""; units = 0; //this("",0); } public InventoryItem(String d) { description = d; units = 0; } public InventoryItem(String d, int u) { description = d; units = u; } public void setDescription(String d) { description = d; } public void setUnits(int u) { units = u; } public String getDescription() { return description; } public int getUnits() { return units; } } blic class InventoryDemo {
  • 2. public static void main(String[] args) { InventoryItem item1 = new InventoryItem(); System.out.println("Item 1:"); System.out.println("Description: " + item1.getDescription()); System.out.println("Units: " + item1.getUnits()); System.out.println(); InventoryItem item2 = new InventoryItem("Wrench"); System.out.println("Item 2:"); System.out.println("Description: " + item2.getDescription()); System.out.println("Units: " + item2.getUnits()); System.out.println(); InventoryItem item3 = new InventoryItem("Hammer", 20); System.out.println("Item 3:"); System.out.println("Description: " + item3.getDescription()); System.out.println("Units: " + item3.getUnits()); } } Write a second class InventoryItem2 which extends InventoryItem and consists of: Variables for the price of the item and brand name of the item A constructor which reads in the four values: description, units, price, and brand. Your constructor should call the super constructor in InventoryItem to set the description and unit variables Create setters and getters for price and brand name You can create a toString method which prints out a complete description of the item. Write a front end called InventoryDemo2 which: Asks for the description, number of units, price, and brand name of the item. Creates an instance of InventoryItem2 and passes the values of the four variables. Then prints out the complete description of the item. Pass in copies of InventoryItem2 and InventoryDemo2. The following is an example printout. run: Enter the description of the item: Hammer Enter the number of units on hand: 20 Enter the price of the item: 19.99 Enter the brand name of the item: Smacko
  • 3. Our Item: Description: Hammer Units: 20 Price: 19.99 Brand: Smacko BUILD SUCCESSFUL (total time: 12 seconds) For Homework #5 InventoryItem description units Constructor(description,units) get/set description get/set units InventoryItem2 extends InventoryItem price brand Constructor(description,units,price,brand) get/set price get/set brand InventoryItem description units Constructor(description,units) get/set description get/set units InventoryItem2 extends InventoryItem price brand Constructor(description,units,price,brand) get/set price get/set brand