Jump to content

Java Help

Guest

Hey Guys

 

Just need pointing in the right direction as to how to go about this task:

 

Design and make a Java application to show your programming skills such as a Lottery style game; inputting numbers to see if they are a winning combination. Keep your idea simple and provide evidence of your application design.

 

 

I'm very new to Java so any help would be appreciated.

 

Thanks :)

Link to comment
Share on other sites

Link to post
Share on other sites

import randomwin = str(random.random())win = win[2:6]print(win)guess = input("Enter 4-digit number to guess: ")if guess == win:	print("You win!")else:	print("Wrong, you lose.")

Here's how you could do it python, hopefully it helps. The first 4 lines are generating a random 4-digit number. The print statement is so you can make sure it actually works, it tells you what the number is. Then you are prompted to guess a 4-digit number which is stored in a variable called guess. From there if guess is equal to win then you win.

 

You'll have to google how to do random numbers in java, but the rest is just printing, if statement, and input (Not sure I think you use scanners)

Link to comment
Share on other sites

Link to post
Share on other sites

Design and make a Java application to show your programming skills such as a Lottery style game; inputting numbers to see if they are a winning combination. Keep your idea simple and provide evidence of your application design.

 

Well before you get started coding, you'll have to decide on the project. What do you want to make?

Link to comment
Share on other sites

Link to post
Share on other sites

If you're planning on using the terminal then the "scanner" class will help you with getting input from the user

Link to comment
Share on other sites

Link to post
Share on other sites

Well before you get started coding, you'll have to decide on the project. What do you want to make?

 

Yup, come up with an idea first and then we will be in a position to help you start thinking about architecture/design.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×