SlideShare a Scribd company logo
1 of 12
Download to read offline
package Assignment;
import java.util.*;
public class assignment
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String repeat = "";
do
{
byte [][] map1 = {};
byte positionx = 54, positiony = 17 , finishx = 2 , finishy = 1;
String z = " ";
String movement = "";
String done = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map1.length-1 ; y++)
{
for (int x = 0 ; x <= map1[1].length-1 ; x++)
{
if (x == positionx && y == positiony)
{
System.out.print(z);
}
else if(y == finishy && x == finishx)
{
System.out.print("X");
}
else if (map1[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement = input.nextLine();
if (movement.equalsIgnoreCase("a"))
{
positionx--;
if (map1[positiony][positionx]==1)
positionx++;
}
else if(movement.equalsIgnoreCase("w"))
{
positiony--;
if(map1[positiony][positionx]==1)
positiony++;
}
else if (movement.equalsIgnoreCase("S"))
{
positiony++;
if(map1[positiony][positionx]==1)
positiony--;
}
else if(movement.equalsIgnoreCase("d"))
{
positionx++;
if(map1[positiony][positionx]==1)
positionx--;
}
}
while (positionx!=finishx ||positiony!=finishy);
System.out.println("Good Job, you have passed stage 1");
input.nextLine();
byte [][] map2 = { };
byte positionx2 = 54, positiony2 = 17 , finishx2 = 2 , finishy2 = 1;
String movement2 = "";
String done2 = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map2.length-1 ; y++)
{
for (int x = 0 ; x <= map2[1].length-1 ; x++)
{
if (x == positionx2 && y == positiony2)
{
System.out.print(z);
}
else if(y == finishy2 && x == finishx2)
{
System.out.print("X");
}
else if (map2[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement2 = input.nextLine();
if (movement2.equalsIgnoreCase("a"))
{
positionx2--;
if (map2[positiony2][positionx2]==1)
positionx2++;
}
else if(movement2.equalsIgnoreCase("w"))
{
positiony2--;
if(map2[positiony2][positionx2]==1)
positiony2++;
}
else if (movement2.equalsIgnoreCase("S"))
{
positiony2++;
if(map2[positiony2][positionx2]==1)
positiony2--;
}
else if(movement2.equalsIgnoreCase("d"))
{
positionx2++;
if(map2[positiony2][positionx2]==1)
positionx2--;
}
}
while(positionx2!=finishx2 ||positiony2!=finishy2);
System.out.println("Good Job, you have passed stage 2");
input.nextLine();
byte [][] map3 = {};
byte positionx3 = 54, positiony3 = 17 , finishx3 = 2 , finishy3 = 1;
String movement3 = "";
String done3 = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map3.length-1 ; y++)
{
for (int x = 0 ; x <= map3[1].length-1 ; x++)
{
if (x == positionx3 && y == positiony3)
{
System.out.print(z);
}
else if(y == finishy3 && x == finishx3)
{
System.out.print("X");
}
else if (map3[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement3 = input.nextLine();
if (movement3.equalsIgnoreCase("a"))
{
positionx3--;
if (map3[positiony3][positionx3]==1)
positionx3++;
}
else if(movement3.equalsIgnoreCase("w"))
{
positiony3--;
if(map3[positiony3][positionx3]==1)
positiony3++;
}
else if (movement3.equalsIgnoreCase("S"))
{
positiony3++;
if(map3[positiony3][positionx3]==1)
positiony3--;
}
else if(movement3.equalsIgnoreCase("d"))
{
positionx3++;
if(map3[positiony3][positionx3]==1)
positionx3--;
}
}
while(positionx3!=finishx3 ||positiony3!=finishy3);
System.out.println("Good Job, you have passed all the stages");
input.nextLine();
do
{
System.out.print("Try Again ? ");
repeat = input.nextLine();
}
while (!repeat.equalsIgnoreCase("y") && !repeat.equalsIgnoreCase("N"));
}
while(repeat.equalsIgnoreCase("y"));
}
}
Solution
package Assignment;
import java.util.*;
public class assignment
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String repeat = "";
do
{
byte [][] map1 = {};
byte positionx = 54, positiony = 17 , finishx = 2 , finishy = 1;
String z = " ";
String movement = "";
String done = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map1.length-1 ; y++)
{
for (int x = 0 ; x <= map1[1].length-1 ; x++)
{
if (x == positionx && y == positiony)
{
System.out.print(z);
}
else if(y == finishy && x == finishx)
{
System.out.print("X");
}
else if (map1[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement = input.nextLine();
if (movement.equalsIgnoreCase("a"))
{
positionx--;
if (map1[positiony][positionx]==1)
positionx++;
}
else if(movement.equalsIgnoreCase("w"))
{
positiony--;
if(map1[positiony][positionx]==1)
positiony++;
}
else if (movement.equalsIgnoreCase("S"))
{
positiony++;
if(map1[positiony][positionx]==1)
positiony--;
}
else if(movement.equalsIgnoreCase("d"))
{
positionx++;
if(map1[positiony][positionx]==1)
positionx--;
}
}
while (positionx!=finishx ||positiony!=finishy);
System.out.println("Good Job, you have passed stage 1");
input.nextLine();
byte [][] map2 = { };
byte positionx2 = 54, positiony2 = 17 , finishx2 = 2 , finishy2 = 1;
String movement2 = "";
String done2 = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map2.length-1 ; y++)
{
for (int x = 0 ; x <= map2[1].length-1 ; x++)
{
if (x == positionx2 && y == positiony2)
{
System.out.print(z);
}
else if(y == finishy2 && x == finishx2)
{
System.out.print("X");
}
else if (map2[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement2 = input.nextLine();
if (movement2.equalsIgnoreCase("a"))
{
positionx2--;
if (map2[positiony2][positionx2]==1)
positionx2++;
}
else if(movement2.equalsIgnoreCase("w"))
{
positiony2--;
if(map2[positiony2][positionx2]==1)
positiony2++;
}
else if (movement2.equalsIgnoreCase("S"))
{
positiony2++;
if(map2[positiony2][positionx2]==1)
positiony2--;
}
else if(movement2.equalsIgnoreCase("d"))
{
positionx2++;
if(map2[positiony2][positionx2]==1)
positionx2--;
}
}
while(positionx2!=finishx2 ||positiony2!=finishy2);
System.out.println("Good Job, you have passed stage 2");
input.nextLine();
byte [][] map3 = {};
byte positionx3 = 54, positiony3 = 17 , finishx3 = 2 , finishy3 = 1;
String movement3 = "";
String done3 = "";
do
{
for (int i = 1 ; i <= 25 ; i++)
System.out.println();
for (int y = 0 ; y <= map3.length-1 ; y++)
{
for (int x = 0 ; x <= map3[1].length-1 ; x++)
{
if (x == positionx3 && y == positiony3)
{
System.out.print(z);
}
else if(y == finishy3 && x == finishx3)
{
System.out.print("X");
}
else if (map3[y][x]==1)
{
System.out.print("?");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
System.out.println("W = up , A = left , S = down , D = right");
System.out.print("Input Movement = ");
movement3 = input.nextLine();
if (movement3.equalsIgnoreCase("a"))
{
positionx3--;
if (map3[positiony3][positionx3]==1)
positionx3++;
}
else if(movement3.equalsIgnoreCase("w"))
{
positiony3--;
if(map3[positiony3][positionx3]==1)
positiony3++;
}
else if (movement3.equalsIgnoreCase("S"))
{
positiony3++;
if(map3[positiony3][positionx3]==1)
positiony3--;
}
else if(movement3.equalsIgnoreCase("d"))
{
positionx3++;
if(map3[positiony3][positionx3]==1)
positionx3--;
}
}
while(positionx3!=finishx3 ||positiony3!=finishy3);
System.out.println("Good Job, you have passed all the stages");
input.nextLine();
do
{
System.out.print("Try Again ? ");
repeat = input.nextLine();
}
while (!repeat.equalsIgnoreCase("y") && !repeat.equalsIgnoreCase("N"));
}
while(repeat.equalsIgnoreCase("y"));
}
}

More Related Content

Similar to package Assignment;import java.util.;public class assignment .pdf

MineSweeper.java public class MS { public static void main(Strin.pdf
MineSweeper.java public class MS { public static void main(Strin.pdfMineSweeper.java public class MS { public static void main(Strin.pdf
MineSweeper.java public class MS { public static void main(Strin.pdfaniyathikitchen
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfeyewatchsystems
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfkokah57440
 
AI CHALLENGE ADMIN
AI CHALLENGE ADMINAI CHALLENGE ADMIN
AI CHALLENGE ADMINAnkit Gupta
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Trace the following part of codes step by step- Show exactly what it w.docx
Trace the following part of codes step by step- Show exactly what it w.docxTrace the following part of codes step by step- Show exactly what it w.docx
Trace the following part of codes step by step- Show exactly what it w.docxgtameka
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfRahul04August
 
The following code, is a one player battleship game in JAVA. Im tryi.pdf
The following code, is a one player battleship game in JAVA. Im tryi.pdfThe following code, is a one player battleship game in JAVA. Im tryi.pdf
The following code, is a one player battleship game in JAVA. Im tryi.pdffonecomp
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory archana singh
 
Please help with this JAVA Assignment and show output if you can ple.pdf
Please help with this JAVA Assignment and show output if you can ple.pdfPlease help with this JAVA Assignment and show output if you can ple.pdf
Please help with this JAVA Assignment and show output if you can ple.pdfaroramobiles1
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Mokshya Priyadarshee
 
Interpolation graph c++
Interpolation graph c++Interpolation graph c++
Interpolation graph c++rpiitcbme
 
1.aimport java.util.Scanner;public class Diamond {   public st.pdf
1.aimport java.util.Scanner;public class Diamond {   public st.pdf1.aimport java.util.Scanner;public class Diamond {   public st.pdf
1.aimport java.util.Scanner;public class Diamond {   public st.pdfaparnatiwari291
 
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdfImport java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdfapexcomputer54
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...Revolution Analytics
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfarishmarketing21
 
Monadologie
MonadologieMonadologie
Monadologieleague
 

Similar to package Assignment;import java.util.;public class assignment .pdf (20)

MineSweeper.java public class MS { public static void main(Strin.pdf
MineSweeper.java public class MS { public static void main(Strin.pdfMineSweeper.java public class MS { public static void main(Strin.pdf
MineSweeper.java public class MS { public static void main(Strin.pdf
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
 
AI CHALLENGE ADMIN
AI CHALLENGE ADMINAI CHALLENGE ADMIN
AI CHALLENGE ADMIN
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Trace the following part of codes step by step- Show exactly what it w.docx
Trace the following part of codes step by step- Show exactly what it w.docxTrace the following part of codes step by step- Show exactly what it w.docx
Trace the following part of codes step by step- Show exactly what it w.docx
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
 
The following code, is a one player battleship game in JAVA. Im tryi.pdf
The following code, is a one player battleship game in JAVA. Im tryi.pdfThe following code, is a one player battleship game in JAVA. Im tryi.pdf
The following code, is a one player battleship game in JAVA. Im tryi.pdf
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory
 
C++ TUTORIAL 10
C++ TUTORIAL 10C++ TUTORIAL 10
C++ TUTORIAL 10
 
Please help with this JAVA Assignment and show output if you can ple.pdf
Please help with this JAVA Assignment and show output if you can ple.pdfPlease help with this JAVA Assignment and show output if you can ple.pdf
Please help with this JAVA Assignment and show output if you can ple.pdf
 
Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)Find the output of the following code (Java for ICSE)
Find the output of the following code (Java for ICSE)
 
Interpolation graph c++
Interpolation graph c++Interpolation graph c++
Interpolation graph c++
 
1.aimport java.util.Scanner;public class Diamond {   public st.pdf
1.aimport java.util.Scanner;public class Diamond {   public st.pdf1.aimport java.util.Scanner;public class Diamond {   public st.pdf
1.aimport java.util.Scanner;public class Diamond {   public st.pdf
 
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdfImport java.awt.; Import acm.program.; Import acm.graphics.;.pdf
Import java.awt.; Import acm.program.; Import acm.graphics.;.pdf
 
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
R + Hadoop = Big Data Analytics. How Revolution Analytics' RHadoop Project Al...
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Insertion Sort Code
Insertion Sort CodeInsertion Sort Code
Insertion Sort Code
 
Monadologie
MonadologieMonadologie
Monadologie
 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
 

More from noelbuddy

1.The pozzolanic reaction is the chemical reaction that occurs in .pdf
1.The pozzolanic reaction is the chemical reaction that occurs in .pdf1.The pozzolanic reaction is the chemical reaction that occurs in .pdf
1.The pozzolanic reaction is the chemical reaction that occurs in .pdfnoelbuddy
 
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdfnoelbuddy
 
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdfnoelbuddy
 
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdfnoelbuddy
 
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdfnoelbuddy
 
just hit the ln button sorry guys .pdf
                     just hit the ln button sorry guys                .pdf                     just hit the ln button sorry guys                .pdf
just hit the ln button sorry guys .pdfnoelbuddy
 
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf
I have seen in a table that pKa of H3PO4 =2.12 s.pdfnoelbuddy
 
#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdfnoelbuddy
 
Yes. You can prove it experimentally, but if you.pdf
                     Yes.  You can prove it experimentally, but if you.pdf                     Yes.  You can prove it experimentally, but if you.pdf
Yes. You can prove it experimentally, but if you.pdfnoelbuddy
 
the one which is oxidized is reducing agent Pb wa.pdf
                     the one which is oxidized is reducing agent Pb wa.pdf                     the one which is oxidized is reducing agent Pb wa.pdf
the one which is oxidized is reducing agent Pb wa.pdfnoelbuddy
 
   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdfnoelbuddy
 
What inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdfWhat inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdfnoelbuddy
 
The tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdfThe tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdfnoelbuddy
 
public class Party {    private int guests;      return .pdf
public class Party {    private int guests;        return .pdfpublic class Party {    private int guests;        return .pdf
public class Party {    private int guests;      return .pdfnoelbuddy
 
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdfThe main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdfnoelbuddy
 
The motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdfThe motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdfnoelbuddy
 
The formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdfThe formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdfnoelbuddy
 
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf
Density = MassVolume = 4.023.57 = 1.126 gml .pdfnoelbuddy
 
D is correct. Solution D .pdf
                     D is correct. Solution                     D .pdf                     D is correct. Solution                     D .pdf
D is correct. Solution D .pdfnoelbuddy
 
doesnt work since S in SO3 is +6 oxidation stat.pdf
                     doesnt work since S in SO3 is +6 oxidation stat.pdf                     doesnt work since S in SO3 is +6 oxidation stat.pdf
doesnt work since S in SO3 is +6 oxidation stat.pdfnoelbuddy
 

More from noelbuddy (20)

1.The pozzolanic reaction is the chemical reaction that occurs in .pdf
1.The pozzolanic reaction is the chemical reaction that occurs in .pdf1.The pozzolanic reaction is the chemical reaction that occurs in .pdf
1.The pozzolanic reaction is the chemical reaction that occurs in .pdf
 
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
11.B. Association of Southeast Asian NationsExplanationASEAN .pdf
 
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf1. Proteobacteria. It is the largest and metabolically diverse group.pdf
1. Proteobacteria. It is the largest and metabolically diverse group.pdf
 
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
1. Adapt (adaptation)2. Evolve (evolution)3. Individual4. Non .pdf
 
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
1) WW1 - Great war or world war 1 is begin on 28th july 1914 in Eur.pdf
 
just hit the ln button sorry guys .pdf
                     just hit the ln button sorry guys                .pdf                     just hit the ln button sorry guys                .pdf
just hit the ln button sorry guys .pdf
 
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf                     I have seen in a table that pKa of H3PO4 =2.12  s.pdf
I have seen in a table that pKa of H3PO4 =2.12 s.pdf
 
#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf#includeiostream#includestring#include fstreamusing name.pdf
#includeiostream#includestring#include fstreamusing name.pdf
 
Yes. You can prove it experimentally, but if you.pdf
                     Yes.  You can prove it experimentally, but if you.pdf                     Yes.  You can prove it experimentally, but if you.pdf
Yes. You can prove it experimentally, but if you.pdf
 
the one which is oxidized is reducing agent Pb wa.pdf
                     the one which is oxidized is reducing agent Pb wa.pdf                     the one which is oxidized is reducing agent Pb wa.pdf
the one which is oxidized is reducing agent Pb wa.pdf
 
   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf   Internet the information super highway, open access, public user.pdf
   Internet the information super highway, open access, public user.pdf
 
What inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdfWhat inequities exist in health careIf you take the question from.pdf
What inequities exist in health careIf you take the question from.pdf
 
The tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdfThe tops for collecting network based evidenceyou think that your.pdf
The tops for collecting network based evidenceyou think that your.pdf
 
public class Party {    private int guests;      return .pdf
public class Party {    private int guests;        return .pdfpublic class Party {    private int guests;        return .pdf
public class Party {    private int guests;      return .pdf
 
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdfThe main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
The main culprit of the scene is suspect 2 ; Roger Coleman, the DNA .pdf
 
The motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdfThe motor ANS is divided into the sympathetic nervous system, which .pdf
The motor ANS is divided into the sympathetic nervous system, which .pdf
 
The formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdfThe formation of a disaccharide involves the condensation of two mon.pdf
The formation of a disaccharide involves the condensation of two mon.pdf
 
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf                     Density = MassVolume = 4.023.57 = 1.126 gml   .pdf
Density = MassVolume = 4.023.57 = 1.126 gml .pdf
 
D is correct. Solution D .pdf
                     D is correct. Solution                     D .pdf                     D is correct. Solution                     D .pdf
D is correct. Solution D .pdf
 
doesnt work since S in SO3 is +6 oxidation stat.pdf
                     doesnt work since S in SO3 is +6 oxidation stat.pdf                     doesnt work since S in SO3 is +6 oxidation stat.pdf
doesnt work since S in SO3 is +6 oxidation stat.pdf
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
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
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
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
 
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
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
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
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
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
 
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
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

package Assignment;import java.util.;public class assignment .pdf

  • 1. package Assignment; import java.util.*; public class assignment { public static void main(String[] args) { Scanner input = new Scanner(System.in); String repeat = ""; do { byte [][] map1 = {}; byte positionx = 54, positiony = 17 , finishx = 2 , finishy = 1; String z = " "; String movement = ""; String done = ""; do { for (int i = 1 ; i <= 25 ; i++) System.out.println(); for (int y = 0 ; y <= map1.length-1 ; y++) { for (int x = 0 ; x <= map1[1].length-1 ; x++) { if (x == positionx && y == positiony) { System.out.print(z); } else if(y == finishy && x == finishx) { System.out.print("X"); } else if (map1[y][x]==1) { System.out.print("?"); }
  • 2. else { System.out.print(" "); } } System.out.println(); } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement = input.nextLine(); if (movement.equalsIgnoreCase("a")) { positionx--; if (map1[positiony][positionx]==1) positionx++; } else if(movement.equalsIgnoreCase("w")) { positiony--; if(map1[positiony][positionx]==1) positiony++; } else if (movement.equalsIgnoreCase("S")) { positiony++; if(map1[positiony][positionx]==1) positiony--; } else if(movement.equalsIgnoreCase("d")) { positionx++; if(map1[positiony][positionx]==1) positionx--; } } while (positionx!=finishx ||positiony!=finishy);
  • 3. System.out.println("Good Job, you have passed stage 1"); input.nextLine(); byte [][] map2 = { }; byte positionx2 = 54, positiony2 = 17 , finishx2 = 2 , finishy2 = 1; String movement2 = ""; String done2 = ""; do { for (int i = 1 ; i <= 25 ; i++) System.out.println(); for (int y = 0 ; y <= map2.length-1 ; y++) { for (int x = 0 ; x <= map2[1].length-1 ; x++) { if (x == positionx2 && y == positiony2) { System.out.print(z); } else if(y == finishy2 && x == finishx2) { System.out.print("X"); } else if (map2[y][x]==1) { System.out.print("?"); } else { System.out.print(" "); } } System.out.println(); } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement2 = input.nextLine();
  • 4. if (movement2.equalsIgnoreCase("a")) { positionx2--; if (map2[positiony2][positionx2]==1) positionx2++; } else if(movement2.equalsIgnoreCase("w")) { positiony2--; if(map2[positiony2][positionx2]==1) positiony2++; } else if (movement2.equalsIgnoreCase("S")) { positiony2++; if(map2[positiony2][positionx2]==1) positiony2--; } else if(movement2.equalsIgnoreCase("d")) { positionx2++; if(map2[positiony2][positionx2]==1) positionx2--; } } while(positionx2!=finishx2 ||positiony2!=finishy2); System.out.println("Good Job, you have passed stage 2"); input.nextLine(); byte [][] map3 = {}; byte positionx3 = 54, positiony3 = 17 , finishx3 = 2 , finishy3 = 1; String movement3 = ""; String done3 = ""; do { for (int i = 1 ; i <= 25 ; i++) System.out.println();
  • 5. for (int y = 0 ; y <= map3.length-1 ; y++) { for (int x = 0 ; x <= map3[1].length-1 ; x++) { if (x == positionx3 && y == positiony3) { System.out.print(z); } else if(y == finishy3 && x == finishx3) { System.out.print("X"); } else if (map3[y][x]==1) { System.out.print("?"); } else { System.out.print(" "); } } System.out.println(); } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement3 = input.nextLine(); if (movement3.equalsIgnoreCase("a")) { positionx3--; if (map3[positiony3][positionx3]==1) positionx3++; } else if(movement3.equalsIgnoreCase("w")) { positiony3--; if(map3[positiony3][positionx3]==1)
  • 6. positiony3++; } else if (movement3.equalsIgnoreCase("S")) { positiony3++; if(map3[positiony3][positionx3]==1) positiony3--; } else if(movement3.equalsIgnoreCase("d")) { positionx3++; if(map3[positiony3][positionx3]==1) positionx3--; } } while(positionx3!=finishx3 ||positiony3!=finishy3); System.out.println("Good Job, you have passed all the stages"); input.nextLine(); do { System.out.print("Try Again ? "); repeat = input.nextLine(); } while (!repeat.equalsIgnoreCase("y") && !repeat.equalsIgnoreCase("N")); } while(repeat.equalsIgnoreCase("y")); } } Solution package Assignment; import java.util.*; public class assignment { public static void main(String[] args)
  • 7. { Scanner input = new Scanner(System.in); String repeat = ""; do { byte [][] map1 = {}; byte positionx = 54, positiony = 17 , finishx = 2 , finishy = 1; String z = " "; String movement = ""; String done = ""; do { for (int i = 1 ; i <= 25 ; i++) System.out.println(); for (int y = 0 ; y <= map1.length-1 ; y++) { for (int x = 0 ; x <= map1[1].length-1 ; x++) { if (x == positionx && y == positiony) { System.out.print(z); } else if(y == finishy && x == finishx) { System.out.print("X"); } else if (map1[y][x]==1) { System.out.print("?"); } else { System.out.print(" "); } } System.out.println();
  • 8. } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement = input.nextLine(); if (movement.equalsIgnoreCase("a")) { positionx--; if (map1[positiony][positionx]==1) positionx++; } else if(movement.equalsIgnoreCase("w")) { positiony--; if(map1[positiony][positionx]==1) positiony++; } else if (movement.equalsIgnoreCase("S")) { positiony++; if(map1[positiony][positionx]==1) positiony--; } else if(movement.equalsIgnoreCase("d")) { positionx++; if(map1[positiony][positionx]==1) positionx--; } } while (positionx!=finishx ||positiony!=finishy); System.out.println("Good Job, you have passed stage 1"); input.nextLine(); byte [][] map2 = { }; byte positionx2 = 54, positiony2 = 17 , finishx2 = 2 , finishy2 = 1; String movement2 = ""; String done2 = "";
  • 9. do { for (int i = 1 ; i <= 25 ; i++) System.out.println(); for (int y = 0 ; y <= map2.length-1 ; y++) { for (int x = 0 ; x <= map2[1].length-1 ; x++) { if (x == positionx2 && y == positiony2) { System.out.print(z); } else if(y == finishy2 && x == finishx2) { System.out.print("X"); } else if (map2[y][x]==1) { System.out.print("?"); } else { System.out.print(" "); } } System.out.println(); } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement2 = input.nextLine(); if (movement2.equalsIgnoreCase("a")) { positionx2--; if (map2[positiony2][positionx2]==1) positionx2++; }
  • 10. else if(movement2.equalsIgnoreCase("w")) { positiony2--; if(map2[positiony2][positionx2]==1) positiony2++; } else if (movement2.equalsIgnoreCase("S")) { positiony2++; if(map2[positiony2][positionx2]==1) positiony2--; } else if(movement2.equalsIgnoreCase("d")) { positionx2++; if(map2[positiony2][positionx2]==1) positionx2--; } } while(positionx2!=finishx2 ||positiony2!=finishy2); System.out.println("Good Job, you have passed stage 2"); input.nextLine(); byte [][] map3 = {}; byte positionx3 = 54, positiony3 = 17 , finishx3 = 2 , finishy3 = 1; String movement3 = ""; String done3 = ""; do { for (int i = 1 ; i <= 25 ; i++) System.out.println(); for (int y = 0 ; y <= map3.length-1 ; y++) { for (int x = 0 ; x <= map3[1].length-1 ; x++) { if (x == positionx3 && y == positiony3) {
  • 11. System.out.print(z); } else if(y == finishy3 && x == finishx3) { System.out.print("X"); } else if (map3[y][x]==1) { System.out.print("?"); } else { System.out.print(" "); } } System.out.println(); } System.out.println("W = up , A = left , S = down , D = right"); System.out.print("Input Movement = "); movement3 = input.nextLine(); if (movement3.equalsIgnoreCase("a")) { positionx3--; if (map3[positiony3][positionx3]==1) positionx3++; } else if(movement3.equalsIgnoreCase("w")) { positiony3--; if(map3[positiony3][positionx3]==1) positiony3++; } else if (movement3.equalsIgnoreCase("S")) { positiony3++; if(map3[positiony3][positionx3]==1)
  • 12. positiony3--; } else if(movement3.equalsIgnoreCase("d")) { positionx3++; if(map3[positiony3][positionx3]==1) positionx3--; } } while(positionx3!=finishx3 ||positiony3!=finishy3); System.out.println("Good Job, you have passed all the stages"); input.nextLine(); do { System.out.print("Try Again ? "); repeat = input.nextLine(); } while (!repeat.equalsIgnoreCase("y") && !repeat.equalsIgnoreCase("N")); } while(repeat.equalsIgnoreCase("y")); } }