Assignment 3A: Rock/Paper/Scissors (Version A)
Assignment 3A — Rock/Paper/Scissors app version A wants us to
begin working on an Android application based on the hand game
"Rock-Paper-Scissors". The goal of "Version A" is to have three working
Buttons, titled Rock, Paper, and Scissors. Upon
clicking each button, the TextView displayed in the bottom-center should say
"Rock", "Paper", or "Scissors" respectively.
Process:
- Created a new project, titled RPSVa
- Created three Buttons in activity_rpsva.xml which represent
Rock/Paper/Scissors
- Created a TextView which, by default, displays "Choose a weapon"
In RPSVa.java:
- Defined the TextView and three Button objects by using
findViewById() and casting those as the desired object type.
- Created three onClick methods for the three buttons in which, upon clicking
Rock/Paper/Scissors, changes the TextView to display the weapon
that was chosen.
This is what the application looks like on startup.
This is what the app looks like upon clicking the "Paper" Button.
Assignment Page