Skip to main content

Designing a Student Grading Android App: A Step-by-Step Guide

 Introduction:

In this blog post, we will walk through the process of designing an Android application that takes student details and subject marks as input, calculates the student's grade based on the obtained percentage, and displays the result using ViewGroup components.

Step1: Setting Up the Project

Start by creating a new Android Studio project. Choose an appropriate project name and set up the basic configuration. Ensure that you have the latest Android SDK installed.

Step2: Desinging the User Interface (UI):

Write a below code in activity_main.xml file located in res ->layout-> activity_main.xml 

Xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity"

>
<EditText
android:id="@+id/editTextName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Name"
android:padding="13dp"
/>
<EditText
android:id="@+id/editTextSubj1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Subj1 Marks"
android:padding="13dp"
/>
<EditText
android:id="@+id/editTextSubj2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Subj2 Marks"
android:padding="13dp"
/>
<EditText
android:id="@+id/editTextSubj3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="13dp"
android:hint="Enter Subj3 Marks"
/>
<Button
android:id="@+id/btncalculate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Calculate Grade"/>

<TextView
android:id="@+id/textviewResult"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"/>
</LinearLayout>

Note: This layout includes EditText for entering student details and subject marks, a Button for triggering the grade calculation, and a TextView for displaying the result.


Step3: Implementing the Logic

Java code(MainActivity.java) Located in Java -> your package name -> MainActivity.java

Java Code:
package com.app.exam;

import static com.app.exam.R.*;

import androidx.appcompat.app.AppCompatActivity;


import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;



public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layout.activity_main);

final EditText editTextname=findViewById(id.editTextName);
final EditText editTextsubject1=findViewById(id.editTextSubj1);
final EditText editTextsubject2=findViewById(id.editTextSubj2);
final EditText editTextsubject3=findViewById(id.editTextSubj3);
final TextView ResultTextView=findViewById(id.textviewResult);
final Button submitbutton=findViewById(id.btncalculate);

submitbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String Name=editTextname.getText().toString();
int subject1 = Integer.parseInt(editTextsubject1.getText().toString());
int subject2=Integer.parseInt(editTextsubject2.getText().toString());
int subject3=Integer.parseInt(editTextsubject3.getText().toString());
double percentage=(subject1+subject2+subject3)/3.0;

String Grade;
if(percentage>=90){
Grade="A";
} else if (percentage<90 && percentage>=75) {
Grade="B";
} else if (percentage<75 && percentage>=50) {
Grade="C";

}
else {
Grade="fail";
}

String result="Name:"+Name+"\nPercentage :"+ percentage +" \nGrade "+ Grade;
ResultTextView.setText(result);
}
});
}
}

OUTPUT:

Output Screen of App















































For Download Android Studio for Application Devlopment Visit on :

Comments

Popular posts from this blog

UML Diagram For Blogging Platform Mini Project -1

In this Article first of all we learn about what is UML?   then we will see the Uml Diagrams for Blogging Platform mini project that helps to student to develope a the Blogging Platform mini project . It helps to student who are studing in BCS,BCA, BTech,BE,MCA for drawing UML diagram for thier acadmic project .they can get referance from this diagrams. Lets Start, What is UML? UML is Stands for Unified Modeling Language . It is a part of Software Engineering . Typically ,software architects or designers aften take the lead in creating UML diagrams to communicate and document the system's design. It's a standardized way to visually represent and design software systems. Followings are UML Diagram 1. ER Diagram for Blogging Platform : 2. Class Diagram : 3. Use Case Diagram: System Use Case Diagram : Use Case Diagram: User Management ,Blog Management,Commenting and interaction Module : Use Case Diagram ...

"Python programiTutorial Part 2: "

  Hey guys , Welcome back in new post Python Tutorial part-2 . Lets start the remaining part here.. First Python Program: Before starting a code we have to install python on your machine for more about installation click me We will discuss the basic syntax of python. now firstly we will see the first and simple "HELLO WORLD "program. Run this program. Python provides us two way to run the program: 1.Using Interactive interpreted command prompt. this is image of Interactive interpreted command prompt with the "HELLO WORLD" program with output. 2.Using a script file. This is the image of  script file with the code of "HELLO WORLD ' program with out put.  Script mode has some advantages and disadvantages : 1.We run multiple lines of code at a time in script mode.  2.Run and interpretation process or debugging is easy in the script mode. 3.It is best for beginners and expert also. Disadvantages:-...

Unveiling the Magic of Model View Template (MVT) in Django | Django Tutorial

Demystifying Model View Template (MVT) in Django Introduction: Have you ever wondered how Django manages to handle data, logic, and user interface? Dive into the world of Model View Template (MVT) architecture to unravel the secrets behind Django's framework. Understanding MVT: Breaking Down the Components  MVT, also known as Model-View-Template, comprises three essential components: the model, the view, and the template. The model handles the data logic, the view processes user requests, and the template manages the user interface. Let's dissect each component to grasp their intricate roles and interactions within the Django framework. Model: The Backbone of Data Handling  In MVT, models are synonymous with templates, simplifying the software design process. They are pivotal in organizing and managing data and templates, streamlining the development journey. Furthermore, the model in Django serves as the representation of the database lo...