Northern Virginia Community College Java Program Worksheet

Purpose – to practiceWriting and invoking methods
Using multiple arguments
· Creating and using a method in another class
Problem Statement
Code a Java program and a method.
Phase 1
• In the Main(), Ask the user to enter an amount they wish to bet and which game they want to play.
Pass the bet and game as an arguments into a method
Your method will validate based on these rules
o if the game is poker, the bet amount must be in the range of $50 to 500.
o any other game, the bet amount must be in the range $10 to $100
Return the validated bet amount to the main().
Print a message in the main. “Thank you for your bet of $
for the game of
Phase 2 – Required
Invoking a Method from another Class
. Move the method out of your program Class and into a file in the same folder as your Main().
Phase 3 – Optional Challenge
• Write the bet amount to a .txt file.
.
Required Material to be Submitted to Canvas
A copy of your MAIN program source code saved to a .TXT file
• A copy of your methods CLASS source code (ex. MyMethods.class)
• A screen capture of your program being executed, with the result showing
Phase 3 – Optional Challenge
Write the bet amount to a .txt file.
nts
Required Material to be Submitted to Canvas
• A copy of your MAIN program source code saved to a .TXT file
A copy of your methods CLASS source code (ex. MyMethods.class)
. A screen capture of your program being executed, with the result showing
Your source code must include the following comment code at the beginning of your program:
// Lab #1
// Name:your name
PS
4/7
Lab 5c
ing
dations
Criteria
Ratings
Pts
invoke method from another class
3 pts
Set up method header
3 pts
Return variable to main()
2 pts
Print message in the Main()
1 pts
Overall
1 pts
Total Points: 10
< Previous Next >
M +
F3
D
to
F4
C
PrtSc
F5
F6
F7
F8
F9
F10
F11
F12
%
&
*
#
3
in t
&
4
(
9
5
6
7
8
0

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER