Simple C++ Functions
Simple C++ Functions
Simple C++ Functions
Table of Content
2|Page
1.0 Introduction
Due to THE COVID-19 pandemic, people's lifestyles have been affected in many ways. The
increased use of online services and applications are some of them. One of the many groups
affected are the patients that depend on prescribed medication from their local public or
government hospitals. With the rise of the pandemic, many hospitals are trying to handle the
sudden influx in cases, decided to postpone the appointments of their regular patients. As a
result, these patients have trouble acquiring new medication, particularly if the hospital
mentioned was designated to handle Covid cases. Therefore, some patients have resulted to
obtaining their medication from private pharmacies, which cost more. In this assignment, our
group were tasked to create a general text-based C++ program for government hospitals.
There are two users who used the system which are Admin Staff and Pharmacist. Below is
the functionality of the System:
Users Function
Admin Staff 1) Login
2) Modify Patient Credit/ Debit Card Details
3) Modify Patient Address
4) Update Appointment Date & Time
Pharmacist 1) Login
2)
3|Page
3.0 Pseudocode
Begin
Declare user as int
REPEAT
Display "====================================="
Display "Welcome to Hospital Management System!"
Display "====================================="
Display "Press 1 to login as Admin"
Display "Press 2 to login as Pharmacists"
Display "Press 3 to exit application"
Display "====================================="
Read user
4|Page
Function AdminLogin()
Declare existAdminId, existAdminPw, adminId, adminPW, bankName, typeOfCard, inputCard, address, city, state, inputAddr as string
Declare existPatRegNum, patRegNum, adminFunc, cardNumber, cardCvc, postCode as int
Declare apptDate, cardExp as date
Declare apptTime as time
Declare presList as array
Display "=========================================="
Repeat
Display "Enter patient registration number: "
Read patRegNum
5|Page
Display "====================================="
Get apptDate, apptTime from text files
Display patName "’s Next Appointment Date is " apptDate ", " apptTime "."
Get presList from text files
REPEAT
Display "====================================="
Display "Press 1 to update credit / debit card"
Display "Press 2 to verify address"
Display "Press 3 to update appointment date & time"
Display "Press 4 to exit"
Display "====================================="
Read adminFunc
IF (adminFunc <> 4) THEN
IF (adminFunc == 1) THEN
Get bankName, typeOfCard, cardNumber, cardCvc, cardExp from text files
6|Page
Display "Expiry Date: " cardExp
Display "====================================="
7|Page
Display "====================================="
Display "========================================="
Display "Enter next Appointment Date: "
Read apptDate
Display "Enter next Appointment Time: "
Read apptTime
8|Page
Display "Appointment Details update successfully!"
Display "==========================================="
Display "New Appointment Date : " apptDate
Display "New Appointment Time : " apptTime
ELSE
Display "Please only key in only 1,2,3,4!"
ENDIF
ENDIF
ENDIF
ENDIF
UNTIL(adminFunc == 4)
ENDIF
ENDIF
UNTIL(patRegNum == -1)
Return
Function PharmacistLogin()
Declare existPharmacistId, existPharmacistPw, pharmacistId, pharmacistPW, patName, address, city, state, medId, medName as string
Declare existPatRegNum, patRegNum, dosage, supplyDateAmount, quantity = 0, amountDispensed, cardNumber, postCode,
amountBoxes as int
9|Page
Display "====================================="
10 | P a g e
DOWHILE(presList not EOF)
Display presList
quantity = dosage * supplyDateAmount
Display "=========================================="
Display "Generating Receipt. Please Wait."
Display "=================================="
Display "ABC Pharmacist
Display "1, Jalan Ali 2,"
Display "Taman Abu, 56100 Kuala Lumpur"
Display "=================================="
Display "Name : " patName
Display "Reg. Number : " patRegNum
Display "Next Appt. Date : " apptDate
Display "Next Appt. Time : " apptTime
Display "Supply : " supplyDateAmount " days"
Display "=================================="
Display "MedicineID MedicineName Quantity (calculated) Quantity (dispensed) Price/unit Total Price
Display "======================================================================="
DOWHILE(billDetail not EOF)
Display billDetail
ENDDO
11 | P a g e
Get cardNumber from text file
Display "==============================================="
Display "Payment via Debit Card : " cardNumber
Display "Total Payable Amount : RM" totalPrice
Display "Date: " todayDate : todayDate
Display "==============================================="
12 | P a g e
System Output (Sample)
=====================================
Welcome to Hospital Management System!
=====================================
Press 1 to login as Admin
Press 2 to login as Pharmacists
Press 3 to exit application
=====================================
1
Please insert AdminID and Password
34552 wrongPw (Note: This is an example with wrong password)
=====================================
Invalid AdminID or Password
Please insert AdminID and Password
34552 correctPw (Note: This is an example with correct password)
=====================================
Welcome 34552!
Enter patient registration number:
112
Patient found!
=====================================
Abu’s Next Appointment Date is 30 October 2021, 2pm.
MedID MedName Dosage (/day)
======================================
H1002 Amlodipine 3 tablets
H1004 Perindopril 2 tablets
D2929 Insulin 300mg
======================================
Press 1 to update credit / debit card
Press 2 to verify address
Press 3 to update appointment date & time
Press 4 to exit
======================================
1
Existing Card Details
======================================
Bank Name : Maybank
Type of card : Debit Card
Card Number : 451297345612
CVC Number : 186
Expiry Date : 10/26
======================================
Do you want to update? (Yes: Y/ No: N)
Y
=====================================
Enter Bank Name :
Public Bank
Enter Type of card :
Debit Card
Enter Card Number :
13 | P a g e
413215794647
Enter CVC Number :
765
Enter Expiry Date :
08/25
Card Details update successfully!
======================================
Press 1 to update credit / debit card
Press 2 to verify address
Press 3 to update appointment date & time
Press 4 to exit
======================================
2
Existing Address Details
======================================
Address : 1, Jalan Abu 10, Taman Ali
City : Cheras
State : Kuala Lumpur
Postcode : 56000
======================================
Do you want to update? (Yes: Y/ No: N)
Y
=====================================
Enter Address :
3, Jalan Ali 6
Enter City :
Cheras
Enter State :
Kuala Lumpur
Enter Postcode :
56000
Patient Address Details update successfully!
======================================
Press 1 to update credit / debit card
Press 2 to verify address
Press 3 to update appointment date & time
Press 4 to exit
======================================
3
Current Appointment Date : 10 October 2021
Current Appointment Time : 2pm
======================================
Enter Next Appointment Date:
30 October 2021
Enter Next Appointment Time:
2pm
Appointment Details update successfully!
======================================
New Appointment Date is 30 October 2021
New Appointment Time is 2pm
14 | P a g e
======================================
Press 1 to update credit / debit card
Press 2 to verify address
Press 3 to update appointment date & time
Press 4 to exit
======================================
4
Enter patient Registration number:
-1
======================================
Welcome to Hospital Management System!
=====================================
Press 1 to login as Admin
Press 2 to login as Pharmacists
Press 3 to exit application
=====================================
2
Please insert PharmacistID and Password
98723 rightPw
=====================================
Welcome 98723!
Enter patient registration number:
112
Patient found!
=====================================
Abu’s Next Appointment Date is 30 October 2021, 2pm.
MedID MedName Dosage (/day)
======================================
H1002 Amlodipine 3 tablets
Medicine amount needed is 60.
Enter amount of medicine (boxes)
6
======================================
H1004 Perindopril 2 tablets
Medicine amount needed is 40.
Enter amount of medicine (boxes)
10
======================================
D2929 Insulin 30mg
Medicine amount needed is 600mg.
Enter amount of medicine (boxes/ strips)
4
======================================
Generating Receipt. Please Wait.
======================================
ABC Pharmacist
1, Jalan Ali 2,
Taman Abu, 56100 Kuala Lumpur
======================================
Name : Abu
15 | P a g e
Reg. Num : 112
Next Appt. Date : 30 October 2021
Next Appt. Time : 2pm
Supply : 20 days
======================================
MedID MedName Quantity(total) Quantity(dispensed) Price/Unit Total Price(RM)
==================================================================
H1002 Amlodipine 60 tablets 6 strips 10.00 60.00
H1004 Perindopril 40 tablets 10 boxes 20.00 200.00
D2929 Insulin 600 mg 4 bottles 15.00 60.00
==================================================================
Payment via Debit Card : 413215794647
Total Payable Amount : RM320.00
Payment Date : 10 October 2021
======================================
Ship From: ABC Pharmacist
1, Jalan Ali 2, Taman Abu, 56100 Kuala Lumpur.
======================================
Ship To : Abu
3, Jalan Ali 6, Taman Aman, Cheras, 56000 Kuala Lumpur
======================================
Receipt & Delivery Label generated successfully!
Returning to Main Menu
======================================
Enter patient registration number:
-1
======================================
Welcome to Hospital Management System!
=====================================
Press 1 to login as Admin
Press 2 to login as Pharmacists
Press 3 to exit application
=====================================
3
Application ended!
======================================
16 | P a g e