Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Where in the world am I? Purpose to practice AND OR & NOT logic Writing simple methods Compound conditions Loops Abbreviated incrementors Displaying Images Methods

Where in the world am I?

Purpose to practice

  • AND OR & NOT logic
  • Writing simple methods
  • Compound conditions
  • Loops
  • Abbreviated incrementors
  • Displaying Images
  • Methods
  • REMEMBER - No sharing of homework files. Come see me if you need help.

Phase 1 - Save your program as HW2.java

This is a game of 3 questions. The object of the game is to determine a persons location (Whitehouse, UVA, the Lincoln Memorial).

Inputs

Ask the player the following yes/no questions and save the user's answers in variables.

  • Are you in DC? Yes no.
  • Are you at a college? yes - no
  • Are you at a house? yes - no

Use confirm dialog boxes to get the yes/no answers from the user.

Add a loop to continue playing the game.

Stop when the user wants to stop.

Count how many times the user played the game. Use the abbreviated incrementor to do this.

Use dialog boxes for ALL of your inputs and outputs in this program

Processing

You MUST use AND OR and NOT to complete this exercise. You MUST use the following assumptions to determine the answer.

  • The White house - is a house that is ALSO located in DC
  • UVA is a college in Virginia. I would know this if EITHER was true.
  • The Lincoln Memorial is located in DC but its NOT a house.

When you figure out what the answer is, output "Oh, I see, you are located at ......"

At the end, output Programmed by: your name

Comment your code, as always.

Phase 2 - Required

Write and execute at least one method. This method MUST be written by you (not a Java predefined method).

Add logic to allow the user to play the game again.

Count the number of times the user has played the game.

Phase 3 - Required - Research Challenge

  • Display an image of each location when you figure out where it is.
  • Use the following names for your image files.
    • whitehouse.jpg
    • uva.jpg
    • lincoln.jpg
  • I will be using these EXACT names when I test your program, so be sure to name them as I have shown above.
  • You can use a dialog box to display images (Google an example). Or you can display the images using a frame.
  • NOTE: I put an image example in Canvas in the module named JAVA CODE EXAMPLES FROM PROF EICHERS. You will find a file in there named imageExample.zip

Sample Run (yours will use dialog boxes) ---- Welcome to Where in the World Am I? ----

Are you in DC? yes/no YES

Are you at a college? yes/no NO

Are you at a house? yes/no NO

------------------------------- Ohhh, I see, you are located at the Lincoln Memorial Do you want to play again? yes/no NO

You played the game 1 time.

Thanks for playing.

JAVA CODING

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago