Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lab Sheet 2: EditText and RadioButton, Assignments of Mobile Computing

Two programming exercises for an Android app development course. The first exercise requires designing an app for an IOT store that calculates the amount payable based on the quantity of items selected. The second exercise requires designing a currency converter app that converts Indian Rupees to US Dollars, Euros, or Japanese Yen. the XML and Java code for both exercises and instructions for completing and submitting the lab sheet. intended for B.Tech students in the Fall semester of the 2022-2023 academic year at VIT-AP University in Andhra Pradesh, India.

Typology: Assignments

2022/2023

Available from 02/04/2023

diabloexodia
diabloexodia 🇮🇳

5 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
VIT-AP UNIVERSITY, ANDHRA PRADESH
Lab Sheet 2 : EditText and RadioButon
Academic year: 2022-2023 Branch/ Class: B.Tech
Semester: Fall Date: 9/10/2022
Faculty Name: Mr. Kolluri Rajesh School: SCOPE
NAME: Dhyan REGNO: 20BCE7648
**********************************************************************************************************
Instructions:
Fill your Name and REGNO.
Complete all the programs, add the code java and XML, input and output Screenshots
after the question on the same document.
Save this File name with your registerno_lab2
eg 18ABC1234_LAB2.doc
Upload it in assignment ->LAB2 in MS TEAM
Lab2:
1. Design the following APP for the IOT store. The cost of Aurdino Uno is 500RS, the cost of WIFI module
is 250RS and the Bluetooth module is 200RS. Based on the quantity compute the Amount payable when
submit button is clicked, When clear is clicked clear all the Editboxes.
CODE (XML)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="47dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="279dp"
android:layout_marginBottom="16dp"
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Lab Sheet 2: EditText and RadioButton and more Assignments Mobile Computing in PDF only on Docsity!

VIT-AP UNIVERSITY, ANDHRA PRADESH

Lab Sheet 2 : EditText and RadioButon

Academic year: 2022 - 2023 Branch/ Class: B.Tech

Semester: Fall Date: 9/10/

Faculty Name: Mr. Kolluri Rajesh School: SCOPE

NAME: Dhyan REGNO: 20BCE

Instructions:

• Fill your Name and REGNO.

• Complete all the programs, add the code java and XML, input and output Screenshots

after the question on the same document.

• Save this File name with your registerno _ lab 2

eg 18ABC1234_LAB 2 .doc

• Upload it in assignment - >LAB 2 in MS TEAM

Lab 2 :

1. Design the following APP for the IOT store. The cost of Aurdino Uno is 500RS, the cost of WIFI module

is 250RS and the Bluetooth module is 200RS. Based on the quantity compute the Amount payable when

submit button is clicked, When clear is clicked clear all the Editboxes.

CODE (XML)

android:text="Wi-Fi Module " app:layout_constraintBottom_toTopOf="@+id/textView4" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView2" /> <TextView android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="48dp" android:layout_marginTop="96dp" android:layout_marginEnd="306dp" android:text="Item" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent"

app:layout_constraintBottom_toTopOf="@+id/b2" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/textView4" app:layout_constraintTop_toBottomOf="@+id/textView6" tools:ignore="SpeakableTextPresentCheck" /> </androidx.constraintlayout.widget.ConstraintLayout> CODE (JAVA)

package com.example.pricecalculator;

import androidx.appcompat.app.AppCompatActivity;

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(R.layout.activity_main);

EditText t1=findViewById(R.id.t1);

EditText t2=findViewById(R.id.t2);

EditText t3=findViewById(R.id.t3);

TextView e1=findViewById(R.id.e1);

Button b1=findViewById(R.id.b1);

Button b2=findViewById(R.id.b2);

b1.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

int s=

Integer.parseInt(t1.getText().toString())500+Integer.parseInt(t2.getText().toString())250+Integer.parseInt(t3.getText().to

String())*200;

e1.setText(String.valueOf(s));

b2.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

t1.setText("");

t2.setText("");

t3.setText("");

//int inr=Integer.valueOf(e.getText().toString());

r1.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

r2.setChecked(false);

r3.setChecked(false);

r2.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

r1.setChecked(false);

r3.setChecked(false);

r3.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

r2.setChecked(false);

r1.setChecked(false);

b.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

double inr=Double.valueOf(e.getText().toString());

if(r1.isChecked())

t.setText("USD = " +String.valueOf(inr*0.013));

} else if (r2.isChecked()) {

t.setText("Euro = " +String.valueOf(inr*0.012));

else

t.setText("Euro = " +String.valueOf(inr*1.81));

CODE (XML):

<androidx.constraintlayout.widget.ConstraintLayout

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="#CA2626"

android:backgroundTint="#C51685"

tools:context=".MainActivity">

<TextView

android:id="@+id/textView"

android:layout_width="280dp"

android:layout_height="82dp"

android:layout_marginStart="161dp"

android:layout_marginTop="104dp"

android:layout_marginEnd="192dp"

android:layout_marginBottom="608dp"

android:text="Currency Converter"

android:textAlignment="center"

android:textColor="#2EEA21"

android:textSize="34sp"

app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.432"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toTopOf="parent"

app:layout_constraintVertical_bias="0.507" />

<RadioGroup

android:id="@+id/rg"

android:layout_width="280dp"

android:layout_height="196dp"

android:layout_marginStart="70dp"

android:layout_marginEnd="61dp"

android:layout_marginBottom="17dp"

app:layout_constraintBottom_toTopOf="@+id/b"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent" />

<RadioButton

android:id="@+id/r1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginStart="61dp"

android:layout_marginTop="197dp"

android:layout_marginEnd="242dp"

android:layout_marginBottom="13dp"

android:text="USD"

android:textColor="#1FDF27"

app:layout_constraintBottom_toTopOf="@+id/r2"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.469"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/textView" />

<RadioButton

android:id="@+id/r2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginStart="60dp"

android:layout_marginTop="13dp"

android:layout_marginEnd="242dp"

android:layout_marginBottom="13dp"

android:text="Euro"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginStart="97dp"

android:layout_marginTop="64dp"

android:layout_marginEnd="105dp"

android:layout_marginBottom="76dp"

android:ems="10"

android:hint="Enter INR"

android:inputType="numberDecimal"

android:minHeight="48dp"

app:layout_constraintBottom_toTopOf="@+id/rg"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toBottomOf="@+id/textView" />

</androidx.constraintlayout.widget.ConstraintLayout>