SlideShare a Scribd company logo
File PrintCoded.java (shown above) contains an incomplete program. The goal of the program is
to take as input strings from the user, and then print out coded (encrypted) versions of those
strings, by replacing each letter with another letter. Complete that program, by defining a
printCoded function, that satisfies the following specs:
Function printCoded takes three arguments, called word, sources, targets. They are all strings.
Function printCoded processes the letters of word one by one, in the order in which they appear
in word. For every such letter X, the function processes X as follows:
If X is equal to the character at position P of sources, then the function prints the character at
position P of targets.
Otherwise, the function prints X.
Note that arguments sources and targets are hardcoded in the main function, the user cannot
change those values. The user can only specify the value of word.
IMPORTANT: you are NOT allowed to modify in any way the main function.
This is an example run of the complete program:
Solution
PrintCoded.java
import java.util.Scanner;
public class PrintCoded
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
String sources = "abcdefghijklmnopqrstuvwxyz";
String targets = "bcdefghijklmnopqrstuvwxyza";
while (true)
{
System.out.printf("Enter some word, or q to quit: ");
String word = in.next();
if (word.equals("q"))
{
System.out.printf("Exiting... ");
System.exit(0);
}
printCoded(word, sources, targets);
System.out.printf("  ");
}
}
public static void printCoded(String word, String sources, String targets){
for(int i=0; i

More Related Content

Similar to File PrintCoded.java (shown above) contains an incomplete program. T.pdf

import java.util.Scanner;Henry Cutler ID 1234 7202.docx
import java.util.Scanner;Henry Cutler ID 1234  7202.docximport java.util.Scanner;Henry Cutler ID 1234  7202.docx
import java.util.Scanner;Henry Cutler ID 1234 7202.docx
wilcockiris
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
Jyothishmathi Institute of Technology and Science Karimnagar
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
muniryaseen
 
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdfYour 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
abhijitmaskey
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
Asaye Dilbo
 
Getting started with Microsoft Excel Macros
Getting started with Microsoft Excel MacrosGetting started with Microsoft Excel Macros
Getting started with Microsoft Excel Macros
Nick Weisenberger
 
Lexical and Parser tool for CBOOP program
Lexical and Parser tool for CBOOP programLexical and Parser tool for CBOOP program
Lexical and Parser tool for CBOOP program
IOSR Journals
 
Function
FunctionFunction
Function
rishabh agrawal
 
Program by Demonstration using Version Space Algebra
Program by Demonstration using Version Space AlgebraProgram by Demonstration using Version Space Algebra
Program by Demonstration using Version Space Algebra
Maeda Hanafi
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
Kuntal Bhowmick
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
ComedyTechnology
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference Note
Chetan Thapa Magar
 
Unit-III.pptx
Unit-III.pptxUnit-III.pptx
Unit-III.pptx
Mehul Desai
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
Rafael Balderosa
 
function in python programming languges .pptx
function in python programming languges .pptxfunction in python programming languges .pptx
function in python programming languges .pptx
rundalomary12
 
Instructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdfInstructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdf
adinathknit
 
Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programming
nmahi96
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
Krushal Kakadia
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
Syed Farjad Zia Zaidi
 

Similar to File PrintCoded.java (shown above) contains an incomplete program. T.pdf (20)

import java.util.Scanner;Henry Cutler ID 1234 7202.docx
import java.util.Scanner;Henry Cutler ID 1234  7202.docximport java.util.Scanner;Henry Cutler ID 1234  7202.docx
import java.util.Scanner;Henry Cutler ID 1234 7202.docx
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdfYour 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
Your 1ab8 c file is doe by Friday 1159pm to be submitted.pdf
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Getting started with Microsoft Excel Macros
Getting started with Microsoft Excel MacrosGetting started with Microsoft Excel Macros
Getting started with Microsoft Excel Macros
 
Shanks
ShanksShanks
Shanks
 
Lexical and Parser tool for CBOOP program
Lexical and Parser tool for CBOOP programLexical and Parser tool for CBOOP program
Lexical and Parser tool for CBOOP program
 
Function
FunctionFunction
Function
 
Program by Demonstration using Version Space Algebra
Program by Demonstration using Version Space AlgebraProgram by Demonstration using Version Space Algebra
Program by Demonstration using Version Space Algebra
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference Note
 
Unit-III.pptx
Unit-III.pptxUnit-III.pptx
Unit-III.pptx
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
 
function in python programming languges .pptx
function in python programming languges .pptxfunction in python programming languges .pptx
function in python programming languges .pptx
 
Instructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdfInstructions Write a program whose main function is merely a.pdf
Instructions Write a program whose main function is merely a.pdf
 
Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programming
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
 

More from footsmart1

Which of the following properties best describes pentoses Pentoses .pdf
Which of the following properties best describes pentoses  Pentoses .pdfWhich of the following properties best describes pentoses  Pentoses .pdf
Which of the following properties best describes pentoses Pentoses .pdf
footsmart1
 
What is going to be the output of the following program #include .pdf
What is going to be the output of the following program  #include   .pdfWhat is going to be the output of the following program  #include   .pdf
What is going to be the output of the following program #include .pdf
footsmart1
 
What competencies underpin successful management in implementing org.pdf
What competencies underpin successful management in implementing org.pdfWhat competencies underpin successful management in implementing org.pdf
What competencies underpin successful management in implementing org.pdf
footsmart1
 
What is frictionSolutionThe force that resist relative motion .pdf
What is frictionSolutionThe force that resist relative motion .pdfWhat is frictionSolutionThe force that resist relative motion .pdf
What is frictionSolutionThe force that resist relative motion .pdf
footsmart1
 
What happens to the nominal exchange rate when the USs rate increa.pdf
What happens to the nominal exchange rate when the USs rate increa.pdfWhat happens to the nominal exchange rate when the USs rate increa.pdf
What happens to the nominal exchange rate when the USs rate increa.pdf
footsmart1
 
What are the recent developments in corporate reporting practice .pdf
What are the recent developments in corporate reporting practice .pdfWhat are the recent developments in corporate reporting practice .pdf
What are the recent developments in corporate reporting practice .pdf
footsmart1
 
We have not seen any humming birds in this forest todayWe have not.pdf
We have not seen any humming birds in this forest todayWe have not.pdfWe have not seen any humming birds in this forest todayWe have not.pdf
We have not seen any humming birds in this forest todayWe have not.pdf
footsmart1
 
Verbal statementscannot be a probabilitythe event is very unlik.pdf
Verbal statementscannot be a probabilitythe event is very unlik.pdfVerbal statementscannot be a probabilitythe event is very unlik.pdf
Verbal statementscannot be a probabilitythe event is very unlik.pdf
footsmart1
 
The three major domains of li.pdf
The three major domains of li.pdfThe three major domains of li.pdf
The three major domains of li.pdf
footsmart1
 
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdfThere are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
footsmart1
 
The steps in the closing process are (1) close credit balances in re.pdf
The steps in the closing process are (1) close credit balances in re.pdfThe steps in the closing process are (1) close credit balances in re.pdf
The steps in the closing process are (1) close credit balances in re.pdf
footsmart1
 
The positron decay of ^15 O goes directly to the ground state of ^15 .pdf
The positron decay of ^15 O goes directly to the ground state of ^15 .pdfThe positron decay of ^15 O goes directly to the ground state of ^15 .pdf
The positron decay of ^15 O goes directly to the ground state of ^15 .pdf
footsmart1
 
The disease bullous pemphigoid results in the destruction of protein.pdf
The disease bullous pemphigoid results in the destruction of protein.pdfThe disease bullous pemphigoid results in the destruction of protein.pdf
The disease bullous pemphigoid results in the destruction of protein.pdf
footsmart1
 
Student Outcome f the broad education necessary to understand th.pdf
Student Outcome f the broad education necessary to understand th.pdfStudent Outcome f the broad education necessary to understand th.pdf
Student Outcome f the broad education necessary to understand th.pdf
footsmart1
 
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdfQUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
footsmart1
 
Post your response to the following focus questionsDescribe a sol.pdf
Post your response to the following focus questionsDescribe a sol.pdfPost your response to the following focus questionsDescribe a sol.pdf
Post your response to the following focus questionsDescribe a sol.pdf
footsmart1
 
Please fill in the code, which only need to add code in the adju.pdf
Please fill in the code, which only need to add code in the adju.pdfPlease fill in the code, which only need to add code in the adju.pdf
Please fill in the code, which only need to add code in the adju.pdf
footsmart1
 
Linear AlgebraHello. I need help with my practice final. I am not .pdf
Linear AlgebraHello. I need help with my practice final. I am not .pdfLinear AlgebraHello. I need help with my practice final. I am not .pdf
Linear AlgebraHello. I need help with my practice final. I am not .pdf
footsmart1
 
Many nations, including the US, already maintain a national DNA data.pdf
Many nations, including the US, already maintain a national DNA data.pdfMany nations, including the US, already maintain a national DNA data.pdf
Many nations, including the US, already maintain a national DNA data.pdf
footsmart1
 
implement the add() method for min-heappublic class Heap {    .pdf
implement the add() method for min-heappublic class Heap {    .pdfimplement the add() method for min-heappublic class Heap {    .pdf
implement the add() method for min-heappublic class Heap {    .pdf
footsmart1
 

More from footsmart1 (20)

Which of the following properties best describes pentoses Pentoses .pdf
Which of the following properties best describes pentoses  Pentoses .pdfWhich of the following properties best describes pentoses  Pentoses .pdf
Which of the following properties best describes pentoses Pentoses .pdf
 
What is going to be the output of the following program #include .pdf
What is going to be the output of the following program  #include   .pdfWhat is going to be the output of the following program  #include   .pdf
What is going to be the output of the following program #include .pdf
 
What competencies underpin successful management in implementing org.pdf
What competencies underpin successful management in implementing org.pdfWhat competencies underpin successful management in implementing org.pdf
What competencies underpin successful management in implementing org.pdf
 
What is frictionSolutionThe force that resist relative motion .pdf
What is frictionSolutionThe force that resist relative motion .pdfWhat is frictionSolutionThe force that resist relative motion .pdf
What is frictionSolutionThe force that resist relative motion .pdf
 
What happens to the nominal exchange rate when the USs rate increa.pdf
What happens to the nominal exchange rate when the USs rate increa.pdfWhat happens to the nominal exchange rate when the USs rate increa.pdf
What happens to the nominal exchange rate when the USs rate increa.pdf
 
What are the recent developments in corporate reporting practice .pdf
What are the recent developments in corporate reporting practice .pdfWhat are the recent developments in corporate reporting practice .pdf
What are the recent developments in corporate reporting practice .pdf
 
We have not seen any humming birds in this forest todayWe have not.pdf
We have not seen any humming birds in this forest todayWe have not.pdfWe have not seen any humming birds in this forest todayWe have not.pdf
We have not seen any humming birds in this forest todayWe have not.pdf
 
Verbal statementscannot be a probabilitythe event is very unlik.pdf
Verbal statementscannot be a probabilitythe event is very unlik.pdfVerbal statementscannot be a probabilitythe event is very unlik.pdf
Verbal statementscannot be a probabilitythe event is very unlik.pdf
 
The three major domains of li.pdf
The three major domains of li.pdfThe three major domains of li.pdf
The three major domains of li.pdf
 
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdfThere are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
There are two major groups of seed plants, gymnosperms (Exercise 24) .pdf
 
The steps in the closing process are (1) close credit balances in re.pdf
The steps in the closing process are (1) close credit balances in re.pdfThe steps in the closing process are (1) close credit balances in re.pdf
The steps in the closing process are (1) close credit balances in re.pdf
 
The positron decay of ^15 O goes directly to the ground state of ^15 .pdf
The positron decay of ^15 O goes directly to the ground state of ^15 .pdfThe positron decay of ^15 O goes directly to the ground state of ^15 .pdf
The positron decay of ^15 O goes directly to the ground state of ^15 .pdf
 
The disease bullous pemphigoid results in the destruction of protein.pdf
The disease bullous pemphigoid results in the destruction of protein.pdfThe disease bullous pemphigoid results in the destruction of protein.pdf
The disease bullous pemphigoid results in the destruction of protein.pdf
 
Student Outcome f the broad education necessary to understand th.pdf
Student Outcome f the broad education necessary to understand th.pdfStudent Outcome f the broad education necessary to understand th.pdf
Student Outcome f the broad education necessary to understand th.pdf
 
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdfQUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
QUESTION 8 1.00000 P Financial intermediaries are different from inve.pdf
 
Post your response to the following focus questionsDescribe a sol.pdf
Post your response to the following focus questionsDescribe a sol.pdfPost your response to the following focus questionsDescribe a sol.pdf
Post your response to the following focus questionsDescribe a sol.pdf
 
Please fill in the code, which only need to add code in the adju.pdf
Please fill in the code, which only need to add code in the adju.pdfPlease fill in the code, which only need to add code in the adju.pdf
Please fill in the code, which only need to add code in the adju.pdf
 
Linear AlgebraHello. I need help with my practice final. I am not .pdf
Linear AlgebraHello. I need help with my practice final. I am not .pdfLinear AlgebraHello. I need help with my practice final. I am not .pdf
Linear AlgebraHello. I need help with my practice final. I am not .pdf
 
Many nations, including the US, already maintain a national DNA data.pdf
Many nations, including the US, already maintain a national DNA data.pdfMany nations, including the US, already maintain a national DNA data.pdf
Many nations, including the US, already maintain a national DNA data.pdf
 
implement the add() method for min-heappublic class Heap {    .pdf
implement the add() method for min-heappublic class Heap {    .pdfimplement the add() method for min-heappublic class Heap {    .pdf
implement the add() method for min-heappublic class Heap {    .pdf
 

Recently uploaded

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
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
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
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
 
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
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
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)
 
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
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
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
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
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 Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
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
 

Recently uploaded (20)

Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
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
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
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
 
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
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
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
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
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...
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
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 Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
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
 

File PrintCoded.java (shown above) contains an incomplete program. T.pdf

  • 1. File PrintCoded.java (shown above) contains an incomplete program. The goal of the program is to take as input strings from the user, and then print out coded (encrypted) versions of those strings, by replacing each letter with another letter. Complete that program, by defining a printCoded function, that satisfies the following specs: Function printCoded takes three arguments, called word, sources, targets. They are all strings. Function printCoded processes the letters of word one by one, in the order in which they appear in word. For every such letter X, the function processes X as follows: If X is equal to the character at position P of sources, then the function prints the character at position P of targets. Otherwise, the function prints X. Note that arguments sources and targets are hardcoded in the main function, the user cannot change those values. The user can only specify the value of word. IMPORTANT: you are NOT allowed to modify in any way the main function. This is an example run of the complete program: Solution PrintCoded.java import java.util.Scanner; public class PrintCoded { public static void main(String[] args) { Scanner in = new Scanner(System.in); String sources = "abcdefghijklmnopqrstuvwxyz"; String targets = "bcdefghijklmnopqrstuvwxyza"; while (true) { System.out.printf("Enter some word, or q to quit: "); String word = in.next();
  • 2. if (word.equals("q")) { System.out.printf("Exiting... "); System.exit(0); } printCoded(word, sources, targets); System.out.printf(" "); } } public static void printCoded(String word, String sources, String targets){ for(int i=0; i