SlideShare a Scribd company logo
MIS 4310-01 Final Take Home Exam (100 points)
DUE: Thursday, December 14th, 2017 by 11:59 PM
Use the code provided on Blackboard as your template. Fill in
your own code where
prompted. When finished, upload to Blackboard a file called
“treasure_hunt.java”. Change
the block comment to include your own name. This is an
individual assignment! Code that
you write that you cannot explain will result in an automatic
zero.
Create a Java application that simulates a treasure hunt with a
2D array. Your output
should match the output below with similar input. Do NOT
alter the code provided. Fill
in code in the SEVEN (7) locations under each comment //
YOUR CODE HERE.
Sample Output:
import java.util.Random;
import java.util.Scanner;
/*
* First Last
* MIS 4310 Fall 2017
* FINAL TAKE HOME EXAM
*/
public class treasure_hunt {
public static void main(String[] args) {
boolean found = false; // is true if the treasure is
found
int dug = 0; // holds the number of times user digs
Random gen = new Random(9);
Scanner scan = new Scanner(System.in);
int locationRow; // stores the row where the treasure
is
int locationCol; // stores the column where the
treasure is
/*
* Generates a String array that looks like
* undug grass when printed to represent the
backyard.
*/
String[][] backyard = new String[5][5];
for (int row = 0; row < backyard.length; row++) {
for (int col = 0; col < backyard[row].length;
col++) {
backyard[row][col] = "^";
System.out.print(backyard[row][col] + " ");
} // end inner loop
System.out.println();
} // end outer loop
/*
* Generate a random number for both the row and
column
* location of the treasure. Store the results in
* locationRow and locationCol, respectively.
* The random numbers should be within the array
dimensions.
*/
//**************************
// YOUR CODE HERE (1 OF 7)
//**************************
/*
* A while loop that runs as long as the treasure
* is not found.
*/
while (found == false) {
/*
* Declare two integer variables, guessRow and
guessCol
* and set them both to -1.
* Increment the variable dug to represent a dig.
*/
//**************************
// YOUR CODE HERE (2 OF 7)
//**************************
/*
* Ask the user which row they want to dig.
* Use a while loop to validate the input.
* Run the while loop as long as the guessRow
* value is outside the bounds of the array.
*/
//**************************
// YOUR CODE HERE (3 OF 7)
//**************************
/*
* Ask the user which column they want to dig.
* Use a while loop to validate the input.
* Run the while loop as long as the guessCol
* value is outside the bounds of the array.
*/
//**************************
// YOUR CODE HERE (4 OF 7)
//**************************
/*
* Use the if statement below to check if both
the guessRow
* and guessCol are both correct. If they are, set
* found equal to true and print "You found the
treasure!"
* Then, mark the location by setting the array
value
* to an "X". Use a nested for loop to print the
array
* with the "X".
*/
//**************************
// YOUR CODE HERE (5 of 7) (inside the if
statement () and {})
//**************************
if () {
} // end if
/*
* The else statement for the if statement you
wrote
* is provided. Within the statement, you will
see code
* that guides the user using an if, if else, and
else
* statement block to the correct ROW.
*
* Using this block as your guide, write another
block
* of if, if else, and else that guides the user to
the
* correct COLUMN.
*
* Find the YOUR CODE HERE 6 and begin
coding after.
*/
else {
System.out.println("Only dirt at (" +
guessRow + ", " + guessCol + ")");
if (guessRow == locationRow) {
System.out.println("You're in the right
row!");
} // end if
else if (guessRow > locationRow ) {
System.out.println("The treasure is to
the north.");
} // end else if
else {
System.out.println("The treasure is to
the south.");
} // end else
//**************************
// YOUR CODE HERE (6 of 7)
//**************************
/*
* Set the backyard value at guessRow and
guessCol
* equal to the letter "O". Print the array
afterward
* using a nested for loop.
*/
//**************************
// YOUR CODE HERE (7 of 7)
//**************************
} // end else
} // end while
/*
* Prints how many digs it took the user to find the
treasure.
*/
System.out.println("You found the treasure after " +
dug + " digs.");
}
}

More Related Content

Similar to MIS 4310-01 Final Take Home Exam (100 points) DUE Thursd.docx

Please read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdfPlease read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdf
shanki7
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
amazing2001
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdf
NuttavutThongjor1
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdf
NuttavutThongjor1
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
dbrienmhompsonkath75
 
Interview C++11 code
Interview C++11 codeInterview C++11 code
Interview C++11 code
Russell Childs
 
Introduction to Dart
Introduction to DartIntroduction to Dart
Introduction to Dart
Ramesh Nair
 
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docxCS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
annettsparrow
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
MARRY7
 
CoffeeScript - An Introduction
CoffeeScript - An IntroductionCoffeeScript - An Introduction
CoffeeScript - An Introduction
Manvendra Singh
 
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfPlease do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
aioils
 
(In java language)1. Use recursion in implementing the binarySearc.pdf
(In java language)1. Use recursion in implementing the binarySearc.pdf(In java language)1. Use recursion in implementing the binarySearc.pdf
(In java language)1. Use recursion in implementing the binarySearc.pdf
rbjain2007
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2
Andrey Karpov
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
contact41
 
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docxAssg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
festockton
 
Please write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdfPlease write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdf
amarndsons
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdf
Conint29
 

Similar to MIS 4310-01 Final Take Home Exam (100 points) DUE Thursd.docx (20)

Please read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdfPlease read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdf
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
 
ts+js
ts+jsts+js
ts+js
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdf
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdf
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
Interview C++11 code
Interview C++11 codeInterview C++11 code
Interview C++11 code
 
Introduction to Dart
Introduction to DartIntroduction to Dart
Introduction to Dart
 
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docxCS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
CS117-S18-AlharbiMohammed-master.gitignore.class.ctxt..docx
 
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx Lab Assignment 4 CSE330 Spring 2014  Skeleton Code for ex.docx
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docx
 
CoffeeScript - An Introduction
CoffeeScript - An IntroductionCoffeeScript - An Introduction
CoffeeScript - An Introduction
 
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfPlease do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdf
 
(In java language)1. Use recursion in implementing the binarySearc.pdf
(In java language)1. Use recursion in implementing the binarySearc.pdf(In java language)1. Use recursion in implementing the binarySearc.pdf
(In java language)1. Use recursion in implementing the binarySearc.pdf
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docxAssg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
Assg 12 Binary Search Trees COSC 2336assg-12.cppAssg 12 Binary .docx
 
Please write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdfPlease write the C++ code that would display the exact same output a.pdf
Please write the C++ code that would display the exact same output a.pdf
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdf
 

More from raju957290

(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
raju957290
 
(Minimum of 250 words with  peer review reference ) I am a nurse.docx
(Minimum of 250 words with  peer review reference ) I am a nurse.docx(Minimum of 250 words with  peer review reference ) I am a nurse.docx
(Minimum of 250 words with  peer review reference ) I am a nurse.docx
raju957290
 
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
raju957290
 
(Links to an external site.) (Links to an external site.) (Links.docx
(Links to an external site.) (Links to an external site.) (Links.docx(Links to an external site.) (Links to an external site.) (Links.docx
(Links to an external site.) (Links to an external site.) (Links.docx
raju957290
 
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
raju957290
 
(minimum of 250 words with peer review reference) What t.docx
(minimum of 250 words with peer review reference) What t.docx(minimum of 250 words with peer review reference) What t.docx
(minimum of 250 words with peer review reference) What t.docx
raju957290
 
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
raju957290
 
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
raju957290
 
(minimum of 250 words with peer review reference) Review HIPAA.docx
(minimum of 250 words with peer review reference) Review HIPAA.docx(minimum of 250 words with peer review reference) Review HIPAA.docx
(minimum of 250 words with peer review reference) Review HIPAA.docx
raju957290
 
(minimum of 250 words with peer review reference)Topic 8 DQ .docx
(minimum of 250 words with peer review reference)Topic 8 DQ .docx(minimum of 250 words with peer review reference)Topic 8 DQ .docx
(minimum of 250 words with peer review reference)Topic 8 DQ .docx
raju957290
 
(minimum of 250 words with peer review reference)Topic 7 D.docx
(minimum of 250 words with peer review reference)Topic 7 D.docx(minimum of 250 words with peer review reference)Topic 7 D.docx
(minimum of 250 words with peer review reference)Topic 7 D.docx
raju957290
 
(Sample) Safety and Health Training Plan 1.0 Intro.docx
(Sample)  Safety and Health Training Plan  1.0 Intro.docx(Sample)  Safety and Health Training Plan  1.0 Intro.docx
(Sample) Safety and Health Training Plan 1.0 Intro.docx
raju957290
 
(SLIDES)Rohingya People Living Conditions---(Housing) and .docx
(SLIDES)Rohingya People  Living Conditions---(Housing) and .docx(SLIDES)Rohingya People  Living Conditions---(Housing) and .docx
(SLIDES)Rohingya People Living Conditions---(Housing) and .docx
raju957290
 
(Need in 8 hours 100 plagiarism free) Read the following es.docx
(Need in 8 hours 100 plagiarism free) Read the following es.docx(Need in 8 hours 100 plagiarism free) Read the following es.docx
(Need in 8 hours 100 plagiarism free) Read the following es.docx
raju957290
 
(note  I am a nurse working in a hospital) Develop a synopsis.docx
(note  I am a nurse working in a hospital) Develop a synopsis.docx(note  I am a nurse working in a hospital) Develop a synopsis.docx
(note  I am a nurse working in a hospital) Develop a synopsis.docx
raju957290
 
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
raju957290
 
(See detail instruction in the attachment)This is a music pape.docx
(See detail instruction in the attachment)This is a music pape.docx(See detail instruction in the attachment)This is a music pape.docx
(See detail instruction in the attachment)This is a music pape.docx
raju957290
 
(please scroll all the way to bottom to see info covered in u3-4.docx
(please scroll all the way to bottom to see info covered in u3-4.docx(please scroll all the way to bottom to see info covered in u3-4.docx
(please scroll all the way to bottom to see info covered in u3-4.docx
raju957290
 
(Insert Student Name) (Insert Student Number) - PPMP20011 Portfo.docx
(Insert Student Name)  (Insert Student Number) - PPMP20011 Portfo.docx(Insert Student Name)  (Insert Student Number) - PPMP20011 Portfo.docx
(Insert Student Name) (Insert Student Number) - PPMP20011 Portfo.docx
raju957290
 
(Just I need APA format and simple Paragraph for each question a.docx
(Just I need APA format and simple Paragraph for each question a.docx(Just I need APA format and simple Paragraph for each question a.docx
(Just I need APA format and simple Paragraph for each question a.docx
raju957290
 

More from raju957290 (20)

(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
(Need in 2 hours) 100 plagiarism freeIn our society as we deal .docx
 
(Minimum of 250 words with  peer review reference ) I am a nurse.docx
(Minimum of 250 words with  peer review reference ) I am a nurse.docx(Minimum of 250 words with  peer review reference ) I am a nurse.docx
(Minimum of 250 words with  peer review reference ) I am a nurse.docx
 
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
(minimum of 250 words with peer review reference)  Topic 8 DQ 1.docx
 
(Links to an external site.) (Links to an external site.) (Links.docx
(Links to an external site.) (Links to an external site.) (Links.docx(Links to an external site.) (Links to an external site.) (Links.docx
(Links to an external site.) (Links to an external site.) (Links.docx
 
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
(Need in 5 hours no essay short answer 100 plagiarism free)De.docx
 
(minimum of 250 words with peer review reference) What t.docx
(minimum of 250 words with peer review reference) What t.docx(minimum of 250 words with peer review reference) What t.docx
(minimum of 250 words with peer review reference) What t.docx
 
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
(Page 132) G. Prewriting Using the Toulmin Model to Get Ideas for.docx
 
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
(Normal Curves, 2013)In the video, Normal Curves,  there is .docx
 
(minimum of 250 words with peer review reference) Review HIPAA.docx
(minimum of 250 words with peer review reference) Review HIPAA.docx(minimum of 250 words with peer review reference) Review HIPAA.docx
(minimum of 250 words with peer review reference) Review HIPAA.docx
 
(minimum of 250 words with peer review reference)Topic 8 DQ .docx
(minimum of 250 words with peer review reference)Topic 8 DQ .docx(minimum of 250 words with peer review reference)Topic 8 DQ .docx
(minimum of 250 words with peer review reference)Topic 8 DQ .docx
 
(minimum of 250 words with peer review reference)Topic 7 D.docx
(minimum of 250 words with peer review reference)Topic 7 D.docx(minimum of 250 words with peer review reference)Topic 7 D.docx
(minimum of 250 words with peer review reference)Topic 7 D.docx
 
(Sample) Safety and Health Training Plan 1.0 Intro.docx
(Sample)  Safety and Health Training Plan  1.0 Intro.docx(Sample)  Safety and Health Training Plan  1.0 Intro.docx
(Sample) Safety and Health Training Plan 1.0 Intro.docx
 
(SLIDES)Rohingya People Living Conditions---(Housing) and .docx
(SLIDES)Rohingya People  Living Conditions---(Housing) and .docx(SLIDES)Rohingya People  Living Conditions---(Housing) and .docx
(SLIDES)Rohingya People Living Conditions---(Housing) and .docx
 
(Need in 8 hours 100 plagiarism free) Read the following es.docx
(Need in 8 hours 100 plagiarism free) Read the following es.docx(Need in 8 hours 100 plagiarism free) Read the following es.docx
(Need in 8 hours 100 plagiarism free) Read the following es.docx
 
(note  I am a nurse working in a hospital) Develop a synopsis.docx
(note  I am a nurse working in a hospital) Develop a synopsis.docx(note  I am a nurse working in a hospital) Develop a synopsis.docx
(note  I am a nurse working in a hospital) Develop a synopsis.docx
 
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
(minimum of 250 words with peer review reference) Topic 8 DQ 2.docx
 
(See detail instruction in the attachment)This is a music pape.docx
(See detail instruction in the attachment)This is a music pape.docx(See detail instruction in the attachment)This is a music pape.docx
(See detail instruction in the attachment)This is a music pape.docx
 
(please scroll all the way to bottom to see info covered in u3-4.docx
(please scroll all the way to bottom to see info covered in u3-4.docx(please scroll all the way to bottom to see info covered in u3-4.docx
(please scroll all the way to bottom to see info covered in u3-4.docx
 
(Insert Student Name) (Insert Student Number) - PPMP20011 Portfo.docx
(Insert Student Name)  (Insert Student Number) - PPMP20011 Portfo.docx(Insert Student Name)  (Insert Student Number) - PPMP20011 Portfo.docx
(Insert Student Name) (Insert Student Number) - PPMP20011 Portfo.docx
 
(Just I need APA format and simple Paragraph for each question a.docx
(Just I need APA format and simple Paragraph for each question a.docx(Just I need APA format and simple Paragraph for each question a.docx
(Just I need APA format and simple Paragraph for each question a.docx
 

Recently uploaded

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
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
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
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
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
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
 
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
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 

Recently uploaded (20)

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
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
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
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
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
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
 
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
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 

MIS 4310-01 Final Take Home Exam (100 points) DUE Thursd.docx

  • 1. MIS 4310-01 Final Take Home Exam (100 points) DUE: Thursday, December 14th, 2017 by 11:59 PM Use the code provided on Blackboard as your template. Fill in your own code where prompted. When finished, upload to Blackboard a file called “treasure_hunt.java”. Change the block comment to include your own name. This is an individual assignment! Code that you write that you cannot explain will result in an automatic zero. Create a Java application that simulates a treasure hunt with a 2D array. Your output should match the output below with similar input. Do NOT alter the code provided. Fill in code in the SEVEN (7) locations under each comment // YOUR CODE HERE. Sample Output: import java.util.Random;
  • 2. import java.util.Scanner; /* * First Last * MIS 4310 Fall 2017 * FINAL TAKE HOME EXAM */ public class treasure_hunt { public static void main(String[] args) { boolean found = false; // is true if the treasure is found int dug = 0; // holds the number of times user digs Random gen = new Random(9); Scanner scan = new Scanner(System.in);
  • 3. int locationRow; // stores the row where the treasure is int locationCol; // stores the column where the treasure is /* * Generates a String array that looks like * undug grass when printed to represent the backyard. */ String[][] backyard = new String[5][5]; for (int row = 0; row < backyard.length; row++) { for (int col = 0; col < backyard[row].length; col++) { backyard[row][col] = "^"; System.out.print(backyard[row][col] + " ");
  • 4. } // end inner loop System.out.println(); } // end outer loop /* * Generate a random number for both the row and column * location of the treasure. Store the results in * locationRow and locationCol, respectively. * The random numbers should be within the array dimensions. */ //************************** // YOUR CODE HERE (1 OF 7) //**************************
  • 5. /* * A while loop that runs as long as the treasure * is not found. */ while (found == false) { /* * Declare two integer variables, guessRow and guessCol * and set them both to -1. * Increment the variable dug to represent a dig. */ //************************** // YOUR CODE HERE (2 OF 7)
  • 6. //************************** /* * Ask the user which row they want to dig. * Use a while loop to validate the input. * Run the while loop as long as the guessRow * value is outside the bounds of the array. */ //************************** // YOUR CODE HERE (3 OF 7) //************************** /* * Ask the user which column they want to dig. * Use a while loop to validate the input.
  • 7. * Run the while loop as long as the guessCol * value is outside the bounds of the array. */ //************************** // YOUR CODE HERE (4 OF 7) //************************** /* * Use the if statement below to check if both the guessRow * and guessCol are both correct. If they are, set * found equal to true and print "You found the treasure!" * Then, mark the location by setting the array value * to an "X". Use a nested for loop to print the array * with the "X".
  • 8. */ //************************** // YOUR CODE HERE (5 of 7) (inside the if statement () and {}) //************************** if () { } // end if /* * The else statement for the if statement you wrote * is provided. Within the statement, you will see code * that guides the user using an if, if else, and else
  • 9. * statement block to the correct ROW. * * Using this block as your guide, write another block * of if, if else, and else that guides the user to the * correct COLUMN. * * Find the YOUR CODE HERE 6 and begin coding after. */ else { System.out.println("Only dirt at (" + guessRow + ", " + guessCol + ")"); if (guessRow == locationRow) { System.out.println("You're in the right row!");
  • 10. } // end if else if (guessRow > locationRow ) { System.out.println("The treasure is to the north."); } // end else if else { System.out.println("The treasure is to the south."); } // end else //**************************
  • 11. // YOUR CODE HERE (6 of 7) //************************** /* * Set the backyard value at guessRow and guessCol * equal to the letter "O". Print the array afterward * using a nested for loop. */ //************************** // YOUR CODE HERE (7 of 7) //************************** } // end else
  • 12. } // end while /* * Prints how many digs it took the user to find the treasure. */ System.out.println("You found the treasure after " + dug + " digs."); } }