SlideShare a Scribd company logo
1 of 12
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-------------.pdfshanki7
 
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.pdfamazing2001
 
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.pdfNuttavutThongjor1
 
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.pdfNuttavutThongjor1
 
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.pdfdbrienmhompsonkath75
 
Introduction to Dart
Introduction to DartIntroduction to Dart
Introduction to DartRamesh 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..docxannettsparrow
 
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.docxMARRY7
 
CoffeeScript - An Introduction
CoffeeScript - An IntroductionCoffeeScript - An Introduction
CoffeeScript - An IntroductionManvendra 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.pdfaioils
 
(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.pdfrbjain2007
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
 
Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Andrey 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 1Troy 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.pdfcontact41
 
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 .docxfestockton
 
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.pdfamarndsons
 
Fix my codeCode.pdf
Fix my codeCode.pdfFix my codeCode.pdf
Fix my codeCode.pdfConint29
 

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 .docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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 .docxraju957290
 
(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.docxraju957290
 
(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 .docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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 .docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 
(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.docxraju957290
 

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

Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
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
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 

Recently uploaded (20)

Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
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
 
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🔝
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
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
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 

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."); } }