Android Studio Help
HW 4. Switch between Screens
In this assignment, you will use Android Studio to build a simple App that contains two screens. The objective is to
get familiar with activities, intents, events, and the methods to handle the events.
The App contains
Two activities/screens: the main screen and the result screen.
The main screen contains TextView, EditText, RadioGroup (that has two radio buttons), and Button. It gets
input scores and calculate the grade once the button “CALCULATE GRADE” is clicked. Then the screen is
switched to the result screen.
The second screen is the result screen. It displays the grade from the main screen’s calculation. It should
include TextView, ImageView, and Button. When the button “RETURN” is clicked, the screen will be
switched back to the main.
You can use any image, text styles, background color, etc. that you like, but the app should contain the
required components, layouts, and functions.
The Calculation of the final grade is based on the following.
Suppose the user enters the scores for the two tests, say, t1 for test 1, and t2 for test 2. If the user is an undergraduate student, the total = t1*30% + t2*70%
If the user is a graduate student, the total = t1*50% + t2*50%
The grade will be decided as the following rule.
If the total greater or equal to 90, the grade is “A”;
If the total is between 80 and 90, the grade is “B”;
If the total is between 70 and 80, the grade is “C”;
If the total is between 60 and 70, the grade is “D”;
If the total is less than 60, the grade is “F”.
You will submit:
1. Four screenshots for the App interface on an emulator (similar to the above examples):
1) A screenshot for a graduate student, with two input test scores, before clicking the button
CALCULATE GRADE
2) A screenshot of the result screen for 1)
3) A screenshot for an undergraduate student, with two input test scores, before clicking the button
CALCULATE GRADE
4) A screenshot of the result screen for 3)
2. Four source codes: MainActivity.java, activity_main.xml, SecondActivity.java, secondActivity.xml
To be specific,
- The App interface should contain the two required screen (components and layouts) (25 pts)
- You program can get the input score numbers from two text views (10 pts) and get the selection from the
radio buttons (10 pts)
- The button CALCULATE GRADE should be able to switch the screen (10 pts) and calculate the grade (20
pts)
- The button RETURN should be able to switch to the main screen (10 pts)
- The TextView for the grade on the result screen should be able to display the corresponding grade based
on different input scores (i.e. it should not be set to a constant value) (15 pts)