AD Lab Manual
AD Lab Manual
1
LIST OF EXPERIMENTS
Page
Ex.No. Date Title of the Experiment Marks Sign
No.
Using react native, build a cross platform
1, application for a BMI calculator.
AVERAGE:
2
EXP NO :1 Using react native, build a cross platform application for a
BMIcalculator.
AIM;
To build a cross platform application for a BMI calculator.
PROCEDURE:
3
Step 5: Testing:
Test your app on both ioS and Android simulators/emulators and real devices to ensure it
works corectly on different platforms.
Step 6: Deployment:
Once you're satisfied with your app, you can deploy it to the respective app stores (Google
Play Store for Android and Apple App Store for ioS).
PROGRAM:
import {
View, Text, Textlnput, Button }
from 'react-native';
const calculateBMI=()=>{
if (height && weight) {
sctBMI(bmiValuc.toFixcd(2):
} {
else
setBMI(null):
}:
4
return(
<Textlnput
placeholder="Height (cm)"
keyboardType="numeric"
value={height)
onChangeText=(setHeight}
<TextInput
placeholder="Weight (kg)"
keyboardType="'numneric"
value={weight}
onChangeText={setWeight}
</View>
);
):
5
OUTPUT:
- -
File Edit Selection View Go Run TerminalHelp indexjs bmi Visual Studio Code D
08
RMCI921
RESULT:
Thus the cross platform application for a BMlcalculator are built successfully by
using react native JS.
6
EXP NO:2 Build a Cross Platform Application for Simple Expense
Manager
AIM:
expense manager which allows
To build a cross-platform application for a simple
entering expenses and income on each day and displays category wise weekly income and
expense., you can use React Native along with some additional libraries for managing state
and navigation.
PROCEDURE:
7
import HomcSereen from'/screens/HomeScreen';
<NavigationContainer>
<Stack.Navigator>
<NavigationContaincr>
HomeScreen': Display the list of transactions and provide options to add new
transactions.
AddTransactionScreen': Allow users to add new expenses or income.
"WeeklySummaryšcreen': Display category-wise weekly income and expense
summary.
Step 5: Implement Functionality:
Implement the functionality for adding transactions, calculating weekly summaries, and
displaying them on the screens.
Step 6: Styling:
Style your application to make it visually appealing and user-friendly.
Step 7: Testing:
Test your application on both i0S and Android simulators/emulators and real devices to
ensure it works correctly on different platforms.
Step 8: Deployment:
Once you're satisfied with your app, you can deploy it to the respective app stores (Google
Play Store for Android and Apple App Store for iOs).
PROGRAM:
import React from 'react':
import {
View, Text, FlatList} from 'react-native':
const transactions = [
{
id: 2, type: 'Income', catcgory: 'Salary', amount: 2000 },
J:
return(
<FlatList
data={transactions}
<Text>{item.category }</Text>
</View>
<View
10
OUTPUT:
React App +
O localhost:3000
Expense Manager
Amount:
Category
Transaction Type: Expense
Add Transaction Expense
Incomne
Weekly Report:
Category: Salary
Incomne: 500
Expense: 0
Category: Food
Income: 0
Expense: 150
• Category: Transportation
Income: 0
Expense: 100
RESULT:
Thus the Cross Platform Application for Simple Expense Manager which allows
entering expenses and income on each day and displays category wise weekly income and
expense calculator are built successfully by using react native JS.
11
EX NO:3 Develop a cross platform application to convert units from
imperial system to metric system
AIM:
To develop a crosS-platform application in Java for unit conversion from the imperial
system to the metric system, you can use the JavaFX framework. JavaFX allows you to create
desktop applications that can run on multiple platforms.
PROCEDURE:
12
Step 5: Bind UI Elements to Conversion Logic:
Bind the input fields and dropdown menus in your Ul to the conversion logic. Whenever the
user enters a value or selects conversion units, trigger the appropriate conversion method
and update the result accordingly.
PROGRAM:
import javafx.application.Application;
import javafx.scene.Scene:
import javafx.sccnc.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField:
import javafx.stage.Stage:
{
public class UnitConverterApp extends Application
13
private Label resultLabel;
@Override
primaryStage.setTitle("Unit Converter"):
/Initialize UI components
I/Layout UI components
VBox layout = new VBox(10);
primaryStage.setScene(scene);
14
primaryStage.show():
{
private void convertUnits()
try {
resultLabel.setText("Invalid input");
return 0.0:
15
public static void main( String[l args) {
launch(args):
OUTPUT:
Code
RESULT:
Thus the cross-platform application in Java for unit conversion from the imperial
system to the metric system are developed successfuly by using javaScript.
16
EX NO:4 Design and Develop a Cross Platform Application for Day
to Day Task (To-Do) Management
AIM:
PROCEDURE:
17
Step 5: Persist Data:
Implement data persistence to store tasks between app sessions. You can use a simple file
based storage mechanism or a database depending on the complexity of your application.
PROGRAM:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage:
@Override
primaryStage.setTitle("Task Manager");
18
/ Initialize UI components
TextField taskInputField = new TextField();
addButton.setOnAction(e -> {
);
/ Layout UI components
primaryStage.setScene(scene):
primaryStage.show();
launch(args);
}
19
OUTPUT:
-
Projects: bash Konsole
File Edit View Bookmarks Settings Help
[adriandavid@localhost Projects]$ gradle -v
Gradle 4.3.1
Groovy: 2.4.8
Ant: Apache Ant (TM) version 1.10.1 compiled on June 26 2018
JVM: 1.8.0_181 (0racle Corporation 25.181-b13)
0S: Linux 4.17.9-200.fc28. x86 64 amd64
:
Projects bash
RESULT:
Thus the design and develop of a cross-platform application for day-to-day task
management using Java, you can utilize JavaFX for the user interface and logic, and then use
a framework like Gluon Mobile to package the application for deployment on multiple
platforms such as Android, ioS, and desktop has been developed successfully
20
EXP NO:5 Design an Android Application using Cordova for a User
Login Screen.
AIM:
To Design anandroid application using Cordova for a user login screen with username,
password, reset button and a submit button. Also, include header image and a label. By
Using layout managers.
PROCEDURE:
cd LoginApp
21
Step 6: Add Header Image:
Place your header image in the www/img' directory.
PROGRAM:
Design UI:
<DOCTYPE html>
<html>
<head>
<title>Login</title>
<head>
<body>
<div class="container">
<h2>Login<h2>
<form id="loginForm">
<label for="username">Username:<Aabel>
<label for-"password">Password:</label>
22
<input type="password" id="password" name="password" required>
<button type="reset">Reset</button>
<button type-"submit">Submit</button>
</form>
</div>
<body>
<htm>
Style Ul:
.container
max-width: 400px;
margin: 0 auto;
text-align: center;
img
max-width: 100%;
form
margin-top: 20px;
label {
display: block;
margin-bottom: 5pX;
23
{
input
width: 100%:
margin-bottom: 10px;
padding: 8px;
button {
margin-right: 10px;
button[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
button[type="reset"]{
background-color: #f44336;
color: white;
border: none;
Handle Login:
{
document.addEvent Listener('deviceready', function()
24
var loginForm = document.getElementByld('login Form');
{
loginForm.addEventListener('submit', function(e)
e.preventDefault()0;
var username =
document.getElementByld('username').value;
var password =
document.getElementByld('password').value;
console.log('Username:', username);
console.log('Password:, password);
25
OUTPUT:
new
2- Notepad
|File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window 2
o
Noc
Redmi
12
RESULT:
Thus the android application using Cordova for a user login screen with username,
password, reset button and a submit button are designed successfully. Using layout
managers.
26
EXP N0 6: Design and develop an android application using Apache
Cordova to find and display the current location
AIM:
To create an Android application using Apache Cordova to find and display the
current location of the user,
PROCEDURE:
27
Step 5: JavaScript Logic:
Create a JavaScript file named 'index.js' in the 'www/js' directory to handle the location
retrieval and display:
PROGRAM:
Design UI:
<!DOCTYPE htm>
<htm>
<head>
<title>Location App</title>
<head>
<body>
</body>
<html>
28
JavaScript Logic:
{
document.addEventListener(deviceready', function()
var getLocationBtn = document.getElementByld('getLocationBtn'):
getLocationBtn.addEventListener('click', function() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
D:
function onSuccess(position) {
function onBrror(error)
{
29
OUTPUT:
G CAWINDOWS\system 32\cmd.exe
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use --warning-mode all' to show the individual deprecation warnings and determine if they come from
ripts or- plugins.
.
See https://docs gradle. org/7.1.1/userguide/command_line_interface .html#sec: command_line_warnings
BUILD SUCCESSFUL in 41s
48 actionable tasks : 48 executed
Built the following apk(s) :
C:\Users\conta\my FirstApp \platforms\android \app\build \outputs\apk\debug \app-debug. apk
RESULT:
Thus the Android Applications are created using Apache Cordova to find and
display the current location of the user,
30
EXP NO: 7a) Write programs using Java to create Android application
having Databases For asimple library application.
AIM:
To create an Android application for a simple library system with a database,
IMPLEMENTATION:
PROCEDURE:
31
Step 2: Set Up Your Android Project:
Design XML layout files for your library application UI, including screens for adding, editing.
and viewing books, and for searching.
PROGRAM:
Database Schema:
public class LibraryContract{
32
public static abstract class BookEntry implements BaseColumns {
@Override
String SQL_CREATE_ENTRIES =
db.execSQL(SQL_CREATE_ENTRIES):
33
@Override
{
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
Database Operations:
{
public class LibraryDataSource
dbHelper.close():
values.put(LibraryContract.BookEntry.COLUMN_NAME_TITLE, title);
34
values.put(LibraryContract.BookEntry.COLUMN_NAME_AUTHOR, author):
values.put(LibraryContract.BookEntry.COLUMN_NAME_PAGES, pages):
OUTPUT:
File Add View Help
p
Issued Books (1)
ID
Member YouTube Channel
Total Members (2)
GO
Blog
Linked In
Issue
Personal Facebook Page
35
RESULT:
Thus the Android application having Databases For a simple library application are
successful created by using Java.
36
EXP NO: 7b)
AIM:
To create an Android application for managing books available, books lent, and book
reservations, you'llneed to integrate with a remote database server for managing student
information and a local database for managing books.
PROCEDURE:
37
Step 5:Set Up Local Database:
Create a local SQLite database to manage the information about available books, lent books,
and book reservations.
Write methods to perform CRUD operations on the local database. For example, methods to
add a book, mark a book as lent, mark a book as reserved, etc.
PROGRAM:
public class BookDataSource {
38
{
public void close)
dbHelper.close);
}
values.put(BookContract.BookEntry.COLUMN_NAME_TITLE, title);
values.put(BookContract.BookEntry.COLUMN_NAME_AUTHOR, author);
values.put(BookContract.BookEntry.COLUMN_NAME_QUANTITY, quantity);
39
/ Query the database for available books
40
OUTPUT:
Execute the application by clicking on the run button. Once, you execute you will see the
below dialog box. In the below dialog box, mention username and password as {admin,
admin). Then click on the Login button.
Login X
Username admin
Password
Once you click on the Login button, you willsee the below dialog box opening up.
Admin Functions
Here you have various options which you can explore. So, let us start with the
first one:
View Books
Once, you click on View Books button, you will see the below frame displaying all
the books present in the database, with their details.
41
Books Available X
BID BNAME GENRE PRICE
1 War and Peace Mystery 200
The Guest Book Fiction 300
3 The Perfect Murder Mystery 150
A Accidental Presidents Biography 250
The Wicked King Fiction 250
View Users
The View Users button is used to view the current users on the system. Since we
just have only one user present i.e the admin, it will show you output as below:
Users List
Create/Reset
This functionality is used to create or reset a database. So, once you click on the
button Create/Rest, you will see the below output:
42
Message X
Database Created/Reset!
OK
Add User
To add a user, click on the option "Add User" and mention details such
as username, password and choose the radio button user or admin. By
default, it will be the user. Then, click on Create.
Username sahiti
Password
Admin User
Create
Issue Book
Suppose, if you are the user, once you click on the Issue Book button, you have
to mention the Book ID, User ID, Period(Number of days for issuing the
book), and the Issue Date as follows:
43
Enter Details X
Book ID(BID) 3
User ID(UID) 2
Period(days) 10
Submit
Then click on Submit. Once, you click on Submit, you will see the below dialog
box:
Message
Book Issued!
OK
Now, if you want to see the issued books details, you can use the View Issued
Books functionality.
44
Users List X
IID UID BID ISSUED_DATE RETURN_DATE PERIOD FINE
02-09-2019 10
Alright, so, now if the user logs in to the system, using the login function, as
below:
Login
Username sahiti
Password
Login
User Functions
Here, the user can view all the books in the database by using the View Books
option and the books issued by the user in the My Books section as below:
Bccks Avalalle R M Becks n
Nar and
The GuestBpck
BUWE
Pead Meatery
GENRE PRICS
0UDBsED.D RETUReLDPERISOEePe
Presisents
Acoidental
Bipgrapty
The Wicked King
45
Now, if you wish to return the book, then you have to choose the option of
Return Book.
Return Book
Once, you click on the Return Book, mention the Issue ID and the return
date as below. Then click on Return.
Enter Details
Issue ID(ID)1
Return Date(DD-MM-YYYY 12-10-2019
Return
JThen, you see a message box
displaying the fine.
Message
OK
After that, you again see a dialog box, showing the message "Book Returned".
Refer below.
Message
i Book Returned!
OK
Now, if you click on the View Issued Books, you will see the below output:
46
Users List X
ID UID BID ISSUED DATE RETURN_DATE PERIOD FINE
1 2 3 02-09-2019 |12-10-2019 10 300
Lastly, if you wish to add a book, you can use the option of Add Book.
Add Book
Click on the Add Book button, and mention the book name, genre and price.
Then, click on the Submit button. Refer below.
Genre Thriller
Price 1000|
Submit
Message
Book added!
OK
Apart from this, you can also, see the added books in the View Books section as
below:
47
Books Available X
BID BNAME GENRE PRICE
War and Peace |Mystery 200
2 The Guest Book Fiction 300
The Perfect Murder Mystery 160
Accidental Presidents Biography 250
The Wicked King Fiction 350
Murder on the Orient Express Thriller 1000
RESULT:
Thus the Android application for managing books available, books lent, and book
reservations, you'll need to integrate with a remote database server for managing student
information and a local database for managing books are created successfully.
48