Group I Assignment
Group I Assignment
GROUP ASSIGNMENT
GROUP I
SUBMITTED TO:
ENGR.LUKMAN SALIHU
1
ANSWERS.
Using Matlab
2
% ATM State Machine Simulation
clc;
clear;
% Define states
START = 1;
VERIFY_CARD = 2;
VERIFY_PIN = 3;
CHOOSING_TRANSACTION = 4;
PERFORMING_TRANSACTION = 5;
EJECTING_CARD = 6;
END = 7;
% Initialize state
state = START;
while true
switch state
case START
fprintf('State: START - Insert your card.\n');
pause(1);
state = VERIFY_CARD;
case VERIFY_CARD
3
validCard = input('State: VERIFY CARD - Is your card valid? (1 for
Yes, 0 for No): ');
if validCard == 1
state = VERIFY_PIN;
else
fprintf('Invalid Card!\n');
state = EJECTING_CARD;
end
case VERIFY_PIN
attempts = 0;
correctPIN = 1234;
while attempts < 3
pin = input('State: VERIFY PIN - Enter PIN: ');
if pin == correctPIN
state = CHOOSING_TRANSACTION;
break;
else
fprintf('Incorrect PIN. Try again.\n');
attempts = attempts + 1;
end
end
if attempts == 3
fprintf('Too many incorrect attempts!\n');
state = EJECTING_CARD;
4
end
case CHOOSING_TRANSACTION
choice = input('State: CHOOSING TRANSACTION - Choose (1:
Withdraw, 2: Deposit, 3: Cancel): ');
if choice == 1 || choice == 2
state = PERFORMING_TRANSACTION;
else
fprintf('Transaction Canceled.\n');
state = EJECTING_CARD;
end
case PERFORMING_TRANSACTION
success = input('State: PERFORMING TRANSACTION - Was the
transaction successful? (1 for Yes, 0 for No): ');
if success
fprintf('Transaction Completed Successfully.\n');
else
fprintf('Transaction Failed.\n');
end
state = EJECTING_CARD;
case EJECTING_CARD
fprintf('State: EJECTING CARD - Your card is being ejected.\n');
state = END;
5
case END
fprintf('State: END - Thank you for using the ATM.\n');
break;
otherwise
fprintf('Error: Unknown State.\n');
break;
end
End
EXPLANATION
States: The ATM moves between predefined states like
VERIFY_CARD, VERIFY_PIN, etc.
Transitions: Input controls transitions:
Valid/Invalid card
Correct/Incorrect PIN with retries
Transaction success/failure
Termination: The program ends at the END state after ejecting the card.
6
7
8
Pictorial Design.
9
2. i. Software Development Process for the Mobile-Based Application
The development of the mobile application follows a structured
Software Development Life Cycle (SDLC) process to ensure its
effectiveness, reliability, and usability. Below is the detailed process:
• Requirement Analysis
- Identify the needs of the users (patients, doctors, and health
administrators).
- Understand specific features required by the board of directors.
Key functionalities include:
i- Wireless data detection.
ii- Degree of infection rating.
iii- Data storage and transmission.
iv- Compatibility with Android smartphones.
v- Conducting two tests before producing results.
vi- Compliance with regulatory standards (HIPAA, GDPR for data privacy).
10
• System Design
Top-Down Design Approach is adopted to break the system into smaller
components.
Design modules include:
• Data Collection Module: Interfaces with wireless health sensors.
• Infection Analysis Module: Processes data and determines infection
rates.
• Result Verification Module: Ensures results are verified after two tests.
• Data Storage Module: Manages data securely.
• Data Transmission Module: Sends data to healthcare servers
or authorized personnel.
• User Interface (UI): Provides an easy-to-use Android application
Interface.
• Implementation
i- Frontend (Android UI):
- Built using Java/Kotlin for Android.
- Incorporates a clean, user-friendly interface with real-time updates
ii. Backend:
- Developed using Python/Django or Node.js.
- Handles infection calculations, data storage, and API communication.
iii- Database:
- Use of secure databases like Firebase or PostgreSQL for storage.
• Testing
i- Unit Testing: Testing individual modules (e.g., Data Collection, Analysis).
ii- Integration Testing: Ensuring all modules interact seamlessly.
iii- User Acceptance Testing (UAT): Ensuring the app meets
user requirements.
• Deployment
i- Release the application on the Google Play Store.
ii- Ensure compatibility across various Android devices.
12
}
time_t now = time(NULL); // Get the current time
char* timestamp = ctime(&now); // Convert time to string
fprintf(file, "Timestamp: %sFever: %d, Cough: %d, Breathlessness:
%d, Risk Score: %d, Result: %s\n\n",
timestamp, fever, cough, breathlessness, risk_score, result);
fclose(file); // Close the file
}
int main() {
int fever, cough, breathlessness;
char result[256];
// Input symptoms
printf("Do you have fever? (1 for Yes, 0 for No): ");
scanf("%d", &fever);
printf("Do you have cough? (1 for Yes, 0 for No): ");
scanf("%d", &cough);
printf("Do you have breathlessness? (1 for Yes, 0 for No): ");
scanf("%d", &breathlessness);
// Display results
13
printf("\nResult: %s\n", result);
printf("Risk Score: %d (Higher scores indicate higher risk)\n",
risk_score);
return 0;
Hardware features
• Wireless sensor
i- Detect vital signs (e.g., body temperature, oxygen saturation).
ii- Communicate data via Bluetooth or Wi-Fi.
• Smartphone (Android):
i- Acts as the user interface.
ii- Receives and processes data wirelessly.
• Cloud Server:
i- Stores and processes patient data securely.
• Optional Hardware:
ii- External COVID-19 testing kits integrated with the application.
Software Features
• Data Detection and Transmission:
- Automatically collects data from wireless sensors.
• Degree of Infection Analysis:
- Uses algorithms to calculate infection rates.
• Data Storage:
- Secure storage using encryption techniques.
• User Interface (UI):
14
- Intuitive design for ease of use of the user.
• Data Transmission:
- Shares data securely with healthcare providers.
15
Step 5. Analyze data (second test)
Step 6. Positive?
.yes > (end as positive)
.no > (end at healthy)
Step 7. Stop.
User Authentication
|
Patient Data Collection
|
Test Result Analysis
|
Data Transmission & Storage
|
Display Test Result & Rating
Algorithm
Step 1. Start
Step 2. Prompt the user to enter the GPA
Step 3. Compare the GPA using the following conditions
If GPA is 4.50 - 5.00, display “First Class”
Else if GPA is 3.50 - 4.49, display “Second Class Upper”
Else if GPA is 2.50 - 3.49, display “Second Class Lower”
Else if GPA is 1.50 - 2.49, display “Third Class”
Else if GPA is 0.00 - 1.49, display “Fail”
Step 4. Stop
Flowchart
16
Start
Input GPA
If GPA is 4.50-5.00
If GPA is 3.50-4.49
If GPA is 2.50-3.49
If GPA is 1.50-2.49
If GPA is 0.00-1.49
Display "Fail"
Stop
17