SlideShare a Scribd company logo
1 of 2
Download to read offline
Lab Task 2:
Use the below code and fill it in where appropriate to prompt the user to insert numbers into the
tree, display tree nodes, search the tree nodes for a number, and delete a node from the tree. The
program must show this message when it starts:
Note: traverse has three types.
import java.io.*; import java.util.*; class TreeApp
{
public static void main(String[] args) throws IOException
{
int value;
Tree theTree = new Tree();
while(true) {
System.out.print("Enter first letter of show, "); System.out.print("insert, find, delete, or traverse:
"); int choice = getChar();
switch(choice)
{
Prepared by: Enrico V. Angeles Lab Manual No. 9 | Page 8
ICT-2201 | Data Structure & Algorithms
A.C. 2022-2023 | Semester 2
value
tree
System.out.print("Enter value to delete: ");
value = getInt();
boolean didDelete = // write the code to delete the node in the
if(didDelete)
// write the code to for message deleted and display the value
else
break; case 't':
System.out.print("Enter type 1, 2 or 3: "); value = getInt();
// write the code to traverse the tree break;
default:
System.out.print("Invalid entryn");
case 's':
// write the code to display the tree break;
case 'i':
System.out.print("Enter value to insert: "); value = getInt();
// write the code to insert the node in the tree break;
case 'f':
System.out.print("Enter value to find: ");
value = getInt();
Node found = // write the code to find the node in the tree if(found != null)
{
}
else
break; case 'd':
public static String getString() throws IOException {
InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new
BufferedReader(isr);
String s = br.readLine();
return s;
}
public static char getChar() throws IOException {
String s = getString(); return s.charAt(0);
}
public static int getInt() throws IOException {
String s = getString(); return Integer.parseInt(s);
}

More Related Content

Similar to Lab Task 2Use the below code and fill it in where appropriate to .pdf

C# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdfC# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdfssuserc77a341
 
An input file A1-txt is given which contains a list of integer values-.docx
An input file A1-txt is given which contains a list of integer values-.docxAn input file A1-txt is given which contains a list of integer values-.docx
An input file A1-txt is given which contains a list of integer values-.docxlauracallander
 
the code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdfthe code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdfrajatchugh13
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming AssignmentCoding Assignment Help
 
Hello. This program has to be done in Eclipse(Program used to write .pdf
Hello. This program has to be done in Eclipse(Program used to write .pdfHello. This program has to be done in Eclipse(Program used to write .pdf
Hello. This program has to be done in Eclipse(Program used to write .pdfarchiesgallery
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 

Similar to Lab Task 2Use the below code and fill it in where appropriate to .pdf (11)

C# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdfC# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdf
 
programming for Calculator in java
programming for Calculator in javaprogramming for Calculator in java
programming for Calculator in java
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
An input file A1-txt is given which contains a list of integer values-.docx
An input file A1-txt is given which contains a list of integer values-.docxAn input file A1-txt is given which contains a list of integer values-.docx
An input file A1-txt is given which contains a list of integer values-.docx
 
Java final lab
Java final labJava final lab
Java final lab
 
the code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdfthe code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdf
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 
07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
Hello. This program has to be done in Eclipse(Program used to write .pdf
Hello. This program has to be done in Eclipse(Program used to write .pdfHello. This program has to be done in Eclipse(Program used to write .pdf
Hello. This program has to be done in Eclipse(Program used to write .pdf
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 

More from pmajanta

Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdf
Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdfLavish Living - Senior Living CommunitiesPrimary Selling Features.pdf
Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdfpmajanta
 
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdf
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdfLea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdf
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdfpmajanta
 
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdf
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdfLea el estudio de caso �Disney Imagineering� y responda las dos preg.pdf
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdfpmajanta
 
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdf
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdfLea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdf
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdfpmajanta
 
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdf
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdfLea atentamente la siguiente noticia y responda las siguientes pregu.pdf
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdfpmajanta
 
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdf
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdfLaura apaga las luces cuando sale de una habitaci�n, trae su botella.pdf
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdfpmajanta
 
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdf
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdfLas t�cnicas para desarrollar el empoderamiento de los empleados inc.pdf
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdfpmajanta
 
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdf
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdfLas siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdf
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdfpmajanta
 
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdf
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdfLas estructuras organizacionales simples a menudo exhiben bajos nive.pdf
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdfpmajanta
 
Las innovaciones disruptivas son creadas por grandes empresas establ.pdf
Las innovaciones disruptivas son creadas por grandes empresas establ.pdfLas innovaciones disruptivas son creadas por grandes empresas establ.pdf
Las innovaciones disruptivas son creadas por grandes empresas establ.pdfpmajanta
 
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdf
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdfLas hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdf
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdfpmajanta
 
Las inversiones en valores de renta variable en las que el inversor .pdf
Las inversiones en valores de renta variable en las que el inversor .pdfLas inversiones en valores de renta variable en las que el inversor .pdf
Las inversiones en valores de renta variable en las que el inversor .pdfpmajanta
 
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdf
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdfLas diferentes secciones del manual CPT utilizan diferentes m�todos .pdf
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdfpmajanta
 
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdf
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdfLas algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdf
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdfpmajanta
 
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdf
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdfLas alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdf
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdfpmajanta
 
Las empresas crean registros comerciales de muchos tipos y almacenan.pdf
Las empresas crean registros comerciales de muchos tipos y almacenan.pdfLas empresas crean registros comerciales de muchos tipos y almacenan.pdf
Las empresas crean registros comerciales de muchos tipos y almacenan.pdfpmajanta
 
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdf
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdfLas agencias de cr�dito patrocinadas por el gobierno federal incluye.pdf
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdfpmajanta
 
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdf
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdfLarry Page, el cofundador de Google, posee el 17,0 de las acciones .pdf
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdfpmajanta
 
Lap report experimnt Laboratory Experiment No. Title Intr.pdf
Lap report experimnt Laboratory Experiment No. Title Intr.pdfLap report experimnt Laboratory Experiment No. Title Intr.pdf
Lap report experimnt Laboratory Experiment No. Title Intr.pdfpmajanta
 
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdf
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdfLako Systems est� calculando los costos de capacitaci�n de la empres.pdf
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdfpmajanta
 

More from pmajanta (20)

Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdf
Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdfLavish Living - Senior Living CommunitiesPrimary Selling Features.pdf
Lavish Living - Senior Living CommunitiesPrimary Selling Features.pdf
 
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdf
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdfLea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdf
Lea el estudio de caso Fidelity Labs y la transformaci�n digital de.pdf
 
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdf
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdfLea el estudio de caso �Disney Imagineering� y responda las dos preg.pdf
Lea el estudio de caso �Disney Imagineering� y responda las dos preg.pdf
 
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdf
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdfLea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdf
Lea el caso pr�ctico y responda las preguntas. �Cree que la Junta .pdf
 
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdf
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdfLea atentamente la siguiente noticia y responda las siguientes pregu.pdf
Lea atentamente la siguiente noticia y responda las siguientes pregu.pdf
 
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdf
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdfLaura apaga las luces cuando sale de una habitaci�n, trae su botella.pdf
Laura apaga las luces cuando sale de una habitaci�n, trae su botella.pdf
 
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdf
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdfLas t�cnicas para desarrollar el empoderamiento de los empleados inc.pdf
Las t�cnicas para desarrollar el empoderamiento de los empleados inc.pdf
 
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdf
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdfLas siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdf
Las siguientes oraciones son demasiado prolijas. Vuelva a escribirlo.pdf
 
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdf
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdfLas estructuras organizacionales simples a menudo exhiben bajos nive.pdf
Las estructuras organizacionales simples a menudo exhiben bajos nive.pdf
 
Las innovaciones disruptivas son creadas por grandes empresas establ.pdf
Las innovaciones disruptivas son creadas por grandes empresas establ.pdfLas innovaciones disruptivas son creadas por grandes empresas establ.pdf
Las innovaciones disruptivas son creadas por grandes empresas establ.pdf
 
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdf
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdfLas hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdf
Las hormigas cortadoras de hojas tropicales recolectan esquejes de h.pdf
 
Las inversiones en valores de renta variable en las que el inversor .pdf
Las inversiones en valores de renta variable en las que el inversor .pdfLas inversiones en valores de renta variable en las que el inversor .pdf
Las inversiones en valores de renta variable en las que el inversor .pdf
 
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdf
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdfLas diferentes secciones del manual CPT utilizan diferentes m�todos .pdf
Las diferentes secciones del manual CPT utilizan diferentes m�todos .pdf
 
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdf
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdfLas algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdf
Las algas del g�nero Caulerpa suelen crecer hasta una longitud de m�.pdf
 
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdf
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdfLas alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdf
Las alas de un murci�lago y las alas de un p�jaro se parecen mucho, .pdf
 
Las empresas crean registros comerciales de muchos tipos y almacenan.pdf
Las empresas crean registros comerciales de muchos tipos y almacenan.pdfLas empresas crean registros comerciales de muchos tipos y almacenan.pdf
Las empresas crean registros comerciales de muchos tipos y almacenan.pdf
 
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdf
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdfLas agencias de cr�dito patrocinadas por el gobierno federal incluye.pdf
Las agencias de cr�dito patrocinadas por el gobierno federal incluye.pdf
 
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdf
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdfLarry Page, el cofundador de Google, posee el 17,0 de las acciones .pdf
Larry Page, el cofundador de Google, posee el 17,0 de las acciones .pdf
 
Lap report experimnt Laboratory Experiment No. Title Intr.pdf
Lap report experimnt Laboratory Experiment No. Title Intr.pdfLap report experimnt Laboratory Experiment No. Title Intr.pdf
Lap report experimnt Laboratory Experiment No. Title Intr.pdf
 
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdf
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdfLako Systems est� calculando los costos de capacitaci�n de la empres.pdf
Lako Systems est� calculando los costos de capacitaci�n de la empres.pdf
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

Lab Task 2Use the below code and fill it in where appropriate to .pdf

  • 1. Lab Task 2: Use the below code and fill it in where appropriate to prompt the user to insert numbers into the tree, display tree nodes, search the tree nodes for a number, and delete a node from the tree. The program must show this message when it starts: Note: traverse has three types. import java.io.*; import java.util.*; class TreeApp { public static void main(String[] args) throws IOException { int value; Tree theTree = new Tree(); while(true) { System.out.print("Enter first letter of show, "); System.out.print("insert, find, delete, or traverse: "); int choice = getChar(); switch(choice) { Prepared by: Enrico V. Angeles Lab Manual No. 9 | Page 8 ICT-2201 | Data Structure & Algorithms A.C. 2022-2023 | Semester 2 value tree System.out.print("Enter value to delete: "); value = getInt(); boolean didDelete = // write the code to delete the node in the if(didDelete) // write the code to for message deleted and display the value else break; case 't': System.out.print("Enter type 1, 2 or 3: "); value = getInt(); // write the code to traverse the tree break; default: System.out.print("Invalid entryn"); case 's':
  • 2. // write the code to display the tree break; case 'i': System.out.print("Enter value to insert: "); value = getInt(); // write the code to insert the node in the tree break; case 'f': System.out.print("Enter value to find: "); value = getInt(); Node found = // write the code to find the node in the tree if(found != null) { } else break; case 'd': public static String getString() throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); return s; } public static char getChar() throws IOException { String s = getString(); return s.charAt(0); } public static int getInt() throws IOException { String s = getString(); return Integer.parseInt(s); }