SlideShare a Scribd company logo
1 of 2
Download to read offline
Write the following Scheme functions in Java:
Solution
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Neshted {
public static String neshted_list(List list){
String output = "";
float count =0;
for(int i : list){
if(count == list.size()/2){
if(list.size() %2 == 0)
output += "()";
else
output += "(";
}
if(count=list.size()/2) {
output += i+")";
}
count ++;
}
return output;
}
public static void main (String args[]){
Integer[] values = {4,5,3,2,8};
List list = Arrays.asList(values);
System.out.println(neshted_list(list));
}
}

More Related Content

More from deepaarora22

A mutant strain of E. coli is found that produces both beta-galactos.pdf
A mutant strain of E. coli is found that produces both beta-galactos.pdfA mutant strain of E. coli is found that produces both beta-galactos.pdf
A mutant strain of E. coli is found that produces both beta-galactos.pdfdeepaarora22
 
An unknown individual launches a series of attacks against the Web s.pdf
An unknown individual launches a series of attacks against the Web s.pdfAn unknown individual launches a series of attacks against the Web s.pdf
An unknown individual launches a series of attacks against the Web s.pdfdeepaarora22
 
Youve completed an interrupted mating experiment in E. coli, the l.pdf
Youve completed an interrupted mating experiment in E. coli, the  l.pdfYouve completed an interrupted mating experiment in E. coli, the  l.pdf
Youve completed an interrupted mating experiment in E. coli, the l.pdfdeepaarora22
 
Write a C program to enter a first name, middle name and last name i.pdf
Write a C program to enter a first name, middle name and last name i.pdfWrite a C program to enter a first name, middle name and last name i.pdf
Write a C program to enter a first name, middle name and last name i.pdfdeepaarora22
 
Why do the soft technologies open more opportunities for women To w.pdf
Why do the soft technologies open more opportunities for women To w.pdfWhy do the soft technologies open more opportunities for women To w.pdf
Why do the soft technologies open more opportunities for women To w.pdfdeepaarora22
 
What are the difference between the testes of a frog and a rat in te.pdf
What are the difference between the testes of a frog and a rat in te.pdfWhat are the difference between the testes of a frog and a rat in te.pdf
What are the difference between the testes of a frog and a rat in te.pdfdeepaarora22
 
Which of the following occurs with disruptive selectiona. Natural .pdf
Which of the following occurs with disruptive selectiona. Natural .pdfWhich of the following occurs with disruptive selectiona. Natural .pdf
Which of the following occurs with disruptive selectiona. Natural .pdfdeepaarora22
 
When comparing replicate populations of plants that are grown in the .pdf
When comparing replicate populations of plants that are grown in the .pdfWhen comparing replicate populations of plants that are grown in the .pdf
When comparing replicate populations of plants that are grown in the .pdfdeepaarora22
 
What is wrong with the following definition of headInsertstruct N.pdf
What is wrong with the following definition of headInsertstruct N.pdfWhat is wrong with the following definition of headInsertstruct N.pdf
What is wrong with the following definition of headInsertstruct N.pdfdeepaarora22
 
What is the BEST way to determine if there are any gaps in your thes.pdf
What is the BEST way to determine if there are any gaps in your thes.pdfWhat is the BEST way to determine if there are any gaps in your thes.pdf
What is the BEST way to determine if there are any gaps in your thes.pdfdeepaarora22
 
What are two specialized epidermal cells and what do they do for the.pdf
What are two specialized epidermal cells and what do they do for the.pdfWhat are two specialized epidermal cells and what do they do for the.pdf
What are two specialized epidermal cells and what do they do for the.pdfdeepaarora22
 
What are the basic differences and commonalties between Structured An.pdf
What are the basic differences and commonalties between Structured An.pdfWhat are the basic differences and commonalties between Structured An.pdf
What are the basic differences and commonalties between Structured An.pdfdeepaarora22
 
Use the following word bank to complete the number 51-100 This struc.pdf
Use the following word bank to complete the number 51-100  This struc.pdfUse the following word bank to complete the number 51-100  This struc.pdf
Use the following word bank to complete the number 51-100 This struc.pdfdeepaarora22
 
The nucleus is something we are debating on Celias thread too. Alt.pdf
The nucleus is something we are debating on Celias thread too. Alt.pdfThe nucleus is something we are debating on Celias thread too. Alt.pdf
The nucleus is something we are debating on Celias thread too. Alt.pdfdeepaarora22
 
2. A one-period rate of return from an investment can be measured as.pdf
2. A one-period rate of return from an investment can be measured as.pdf2. A one-period rate of return from an investment can be measured as.pdf
2. A one-period rate of return from an investment can be measured as.pdfdeepaarora22
 
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdfdeepaarora22
 
Qualitative methods tend to have those characteristics. Establis.pdf
Qualitative methods tend to have those characteristics.  Establis.pdfQualitative methods tend to have those characteristics.  Establis.pdf
Qualitative methods tend to have those characteristics. Establis.pdfdeepaarora22
 
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdf
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdfonchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdf
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdfdeepaarora22
 
1. My anatomy I am quite small as compared to many microorganisms. M.pdf
1. My anatomy I am quite small as compared to many microorganisms. M.pdf1. My anatomy I am quite small as compared to many microorganisms. M.pdf
1. My anatomy I am quite small as compared to many microorganisms. M.pdfdeepaarora22
 
Normalization work as through a series of stages called normal forms .pdf
Normalization work as through a series of stages called normal forms .pdfNormalization work as through a series of stages called normal forms .pdf
Normalization work as through a series of stages called normal forms .pdfdeepaarora22
 

More from deepaarora22 (20)

A mutant strain of E. coli is found that produces both beta-galactos.pdf
A mutant strain of E. coli is found that produces both beta-galactos.pdfA mutant strain of E. coli is found that produces both beta-galactos.pdf
A mutant strain of E. coli is found that produces both beta-galactos.pdf
 
An unknown individual launches a series of attacks against the Web s.pdf
An unknown individual launches a series of attacks against the Web s.pdfAn unknown individual launches a series of attacks against the Web s.pdf
An unknown individual launches a series of attacks against the Web s.pdf
 
Youve completed an interrupted mating experiment in E. coli, the l.pdf
Youve completed an interrupted mating experiment in E. coli, the  l.pdfYouve completed an interrupted mating experiment in E. coli, the  l.pdf
Youve completed an interrupted mating experiment in E. coli, the l.pdf
 
Write a C program to enter a first name, middle name and last name i.pdf
Write a C program to enter a first name, middle name and last name i.pdfWrite a C program to enter a first name, middle name and last name i.pdf
Write a C program to enter a first name, middle name and last name i.pdf
 
Why do the soft technologies open more opportunities for women To w.pdf
Why do the soft technologies open more opportunities for women To w.pdfWhy do the soft technologies open more opportunities for women To w.pdf
Why do the soft technologies open more opportunities for women To w.pdf
 
What are the difference between the testes of a frog and a rat in te.pdf
What are the difference between the testes of a frog and a rat in te.pdfWhat are the difference between the testes of a frog and a rat in te.pdf
What are the difference between the testes of a frog and a rat in te.pdf
 
Which of the following occurs with disruptive selectiona. Natural .pdf
Which of the following occurs with disruptive selectiona. Natural .pdfWhich of the following occurs with disruptive selectiona. Natural .pdf
Which of the following occurs with disruptive selectiona. Natural .pdf
 
When comparing replicate populations of plants that are grown in the .pdf
When comparing replicate populations of plants that are grown in the .pdfWhen comparing replicate populations of plants that are grown in the .pdf
When comparing replicate populations of plants that are grown in the .pdf
 
What is wrong with the following definition of headInsertstruct N.pdf
What is wrong with the following definition of headInsertstruct N.pdfWhat is wrong with the following definition of headInsertstruct N.pdf
What is wrong with the following definition of headInsertstruct N.pdf
 
What is the BEST way to determine if there are any gaps in your thes.pdf
What is the BEST way to determine if there are any gaps in your thes.pdfWhat is the BEST way to determine if there are any gaps in your thes.pdf
What is the BEST way to determine if there are any gaps in your thes.pdf
 
What are two specialized epidermal cells and what do they do for the.pdf
What are two specialized epidermal cells and what do they do for the.pdfWhat are two specialized epidermal cells and what do they do for the.pdf
What are two specialized epidermal cells and what do they do for the.pdf
 
What are the basic differences and commonalties between Structured An.pdf
What are the basic differences and commonalties between Structured An.pdfWhat are the basic differences and commonalties between Structured An.pdf
What are the basic differences and commonalties between Structured An.pdf
 
Use the following word bank to complete the number 51-100 This struc.pdf
Use the following word bank to complete the number 51-100  This struc.pdfUse the following word bank to complete the number 51-100  This struc.pdf
Use the following word bank to complete the number 51-100 This struc.pdf
 
The nucleus is something we are debating on Celias thread too. Alt.pdf
The nucleus is something we are debating on Celias thread too. Alt.pdfThe nucleus is something we are debating on Celias thread too. Alt.pdf
The nucleus is something we are debating on Celias thread too. Alt.pdf
 
2. A one-period rate of return from an investment can be measured as.pdf
2. A one-period rate of return from an investment can be measured as.pdf2. A one-period rate of return from an investment can be measured as.pdf
2. A one-period rate of return from an investment can be measured as.pdf
 
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf
19. Photosynthetic organisms are found in the Domain Eukarya as well .pdf
 
Qualitative methods tend to have those characteristics. Establis.pdf
Qualitative methods tend to have those characteristics.  Establis.pdfQualitative methods tend to have those characteristics.  Establis.pdf
Qualitative methods tend to have those characteristics. Establis.pdf
 
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdf
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdfonchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdf
onchange, onclick and onkeyup, are some examples of ...A. Tags B. .pdf
 
1. My anatomy I am quite small as compared to many microorganisms. M.pdf
1. My anatomy I am quite small as compared to many microorganisms. M.pdf1. My anatomy I am quite small as compared to many microorganisms. M.pdf
1. My anatomy I am quite small as compared to many microorganisms. M.pdf
 
Normalization work as through a series of stages called normal forms .pdf
Normalization work as through a series of stages called normal forms .pdfNormalization work as through a series of stages called normal forms .pdf
Normalization work as through a series of stages called normal forms .pdf
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
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
 

Recently uploaded (20)

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
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
 

Write the following Scheme functions in JavaSolutionimport ja.pdf

  • 1. Write the following Scheme functions in Java: Solution import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Neshted { public static String neshted_list(List list){ String output = ""; float count =0; for(int i : list){ if(count == list.size()/2){ if(list.size() %2 == 0) output += "()"; else output += "("; } if(count=list.size()/2) { output += i+")"; } count ++; } return output; } public static void main (String args[]){ Integer[] values = {4,5,3,2,8}; List list = Arrays.asList(values); System.out.println(neshted_list(list)); }
  • 2. }