0% found this document useful (0 votes)
6 views17 pages

Group I Assignment

The document outlines a group assignment for a Computer Programming course at Kwara State Polytechnic, detailing the design of an ATM system and a mobile-based application for COVID-19 symptom checking. It includes state diagrams, a software development process, algorithms for symptom detection, and GPA classification. The assignment emphasizes structured development, user interface design, and secure data handling.

Uploaded by

easylifecafe5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views17 pages

Group I Assignment

The document outlines a group assignment for a Computer Programming course at Kwara State Polytechnic, detailing the design of an ATM system and a mobile-based application for COVID-19 symptom checking. It includes state diagrams, a software development process, algorithms for symptom detection, and GPA classification. The assignment emphasizes structured development, user interface design, and secure data handling.

Uploaded by

easylifecafe5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

INSTITUTE OF TECHNOLOGY

KWARA STATE POLYTECHNIC, ILORIN


DEPARTMENT OF MECHANICAL ENGINEERING TECHNOLOGY
COURSE: COMPUTER PROGRAMMING
COURSE CODE: COM 311

GROUP ASSIGNMENT

GROUP I

AKINYEMI RAHMAN .O. KPHNDFT2024_03192


ABDULKAREEM HABEEBLAHI .A. KPHNDFT2024_00867
OMOLABI FAWAZ ADEBAYO KPHNDFT2024_01491
ABOLAJI OLAYIWOLA KPHNDFT2024_01515
MALIK ISIAKA BABATUNDE KPHNDFT2024_00819
HAMID JAMIU MAYORWA KPHNDFT2024_08055
ALABI TESLIM ISHOLA KPHNDFT2024_02650
HASSAN LAWAL OLADIPUPO KPHNDFT2024_02580
PIUS OSAS LUCKY KPHNDFT2024_00626
OLALEYE BABAJIDE .M. KPHNDFT2024_10125

SUBMITTED TO:
ENGR.LUKMAN SALIHU

1
ANSWERS.

1. To design a state diagram for the described ATM system, we need to


consider the five states:
Verify Card
Verify PIN
Choosing Transaction
Performing Transaction
Ejecting Card.

Suggested State Diagram

1. Start (Initial State):


a. Transition to Verify Card when a card is inserted.
2. Verify Card:
a. If the card is valid → Transition to Verify PIN.
b. If the card is invalid → Transition to Ejecting Card.
3. Verify PIN:
a. If the PIN is correct → Transition to Choosing Transaction.
b. If the PIN is incorrect (e.g., max retries exceeded) → Transition to
Ejecting Card.
4. Choosing Transaction:
a. User selects a transaction → Transition to Performing Transaction.
b. If user cancels → Transition to Ejecting Card.
5. Performing Transaction:
a. Once the transaction is successful → Transition to Ejecting Card.
b. If the transaction fails → Option to retry, or transition to
Ejecting Card.
6. Ejecting Card:
a. Card is ejected → System transitions to the End or Initial State for
the next session.

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.

• Maintenance and Updates


11
i- Regular updates to fix bugs, improve performance, and comply with
new Regulations.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

// Function to detect COVID-19 likelihood based on symptoms


void detect_covid(int fever, int cough, int breathlessness, char* result) {
if (fever && cough && breathlessness) {
sprintf(result, "High likelihood of COVID-19. Please consult a
doctor immediately.");
} else if (fever || cough || breathlessness) {
sprintf(result, "Some symptoms detected. Monitor closely and seek
medical advice if symptoms worsen.");
} else {
sprintf(result, "No COVID-19 symptoms detected. Stay safe!");
}
}

// Function to calculate a risk score based on symptoms


int calculate_risk_score(int fever, int cough, int breathlessness) {
return fever * 3 + cough * 2 + breathlessness * 5;
}

// Function to log the results to a file


void log_results(int fever, int cough, int breathlessness, const char*
result, int risk_score) {
FILE *file = fopen("covid_log.txt", "a"); // Open file in append mode
if (file == NULL) {
printf("Error: Unable to open file for logging.\n");
return;

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];

printf("Welcome to the COVID-19 Symptom Checker!\n");


printf("Please answer the following questions:\n");

// 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);

// Detect COVID-19 likelihood


detect_covid(fever, cough, breathlessness, result);

// Calculate risk score


int risk_score = calculate_risk_score(fever, cough, breathlessness);

// Display results
13
printf("\nResult: %s\n", result);
printf("Risk Score: %d (Higher scores indicate higher risk)\n",
risk_score);

// Log results to a file


log_results(fever, cough, breathlessness, result, risk_score);

printf("\nYour results have been logged to 'covid_log.txt'.\n");


printf("Thank you for using the COVID-19 Symptom Checker. Stay
safe!\n");

return 0;

ii. Hardware and Software Features

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.

iii. Algorithm to support the answer.


Step 1. Start
Step 2. Detect data from sensors
Step 3. Analyze data (first test)
Step 4. Positive?
.yes > request 2nd test
.no > healthy

15
Step 5. Analyze data (second test)
Step 6. Positive?
.yes > (end as positive)
.no > (end at healthy)
Step 7. Stop.

iv. Bottom-up Design.

User Authentication
|
Patient Data Collection
|
Test Result Analysis
|
Data Transmission & Storage
|
Display Test Result & Rating

3. Algorithm and Flowchart.

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

Display "First Class"

If GPA is 3.50-4.49

Display "Second Class Upper"

If GPA is 2.50-3.49

Display "Second Class Lower"

If GPA is 1.50-2.49

Display "Third Class"

If GPA is 0.00-1.49

Display "Fail"

Stop

17

You might also like