You are on page 1of 13

FUNDAMENTALS OF SOFTWARE DEVELOPMENT

ASSIGNMENT:-1

SUBMITTED BY:

SUBMITTED TO:

DATE:
Question:

1. You are required to design a complete system which will


enable you to calculate the actual amount of salary which an
employee is to obtain from the company based on the income
tax table provided below.

Salary Range Income Tax (%)


0 to < 3000 0
3000 to < 5000 6
5000 to < 7000 8
7000 to < 8000 12
8000 to < 9000 16
>=9000 40

2. Find simple interest. Write pseudocode and flowchart.


SI=P*T*R
100
If SI value is greater than 20 , print greater.
Answers: Qno. 1

Pseudocode

Start

Input salary(S)

IF 0 < S < 3000

Tax% = 0%

ELSE IF 3000 < S < 5000

Tax% = 6%

ELSE IF 5000 < S < 7000

Tax% = 8%

ELSE IF 7000 < S < 8000

Tax% = 12%

ELSE IF 8000 < S < 9000

Tax% = 16%

ELSE

Tax% = 40%

END IF

A = S- (Tax% * S)

PRINT “ACTUAL SALARY = A”

END
Flowchart:

START
START
INPUT SALARY(S)

yes
IF Tax% = 0%
0<S<3000?

no

IF
yes Tax% = 6%
3000<S<5000?

no

no Tax% = 8%
IF
5000<S<7000?
yes

no

IF yes Tax% = 12%


7000<S<8000

no

IF yes
Tax% = 16%
8000<S<9000?

no
Tax% = 40% A=S-(Tax%*S) PRINT “ACTUAL
SALARY=A”
END

Qno.2: Pseudocode:

START

INPUT Principle(P)

INPUT Time(T)

INPUT Rate(R)

SI = P*T*R

100

PRINT “ SIMPLE INTEREST = SI”

IF SI > 20 THEN

PRINT “GREATER”

END IF

END
Flowchart:

START

INPUT P

INPUT T

INPUT R

SI=P*T*R

100

PRINT “SIMPLE INTEREST = SI”

YES
IF S > PRINT “GREATER”

NO END
an example Python program that could serve as the basis for a
hospital registration and admission system. Here's an example:

python
class Patient:
def __init__(self, name, age, gender, symptoms):
self.name = name
self.age = age
self.gender = gender
self.symptoms = symptoms
self.admitted = False
self.recovered = False

class Hospital:
def __init__(self):
self.patients = []

def register_patient(self, name, age, gender, symptoms):


patient = Patient(name, age, gender, symptoms)
self.patients.append(patient)
print("Patient {} registered
successfully!".format(patient.name))

def admit_patient(self, name):


patient = self.find_patient_by_name(name)
if patient:
patient.admitted = True
print("Patient {} admitted to the
hospital!".format(patient.name))
else:
print("Patient not found!")
def discharge_patient(self, name):
patient = self.find_patient_by_name(name)
if patient and patient.admitted and patient.recovered:
self.patients.remove(patient)
print("Patient {} discharged from the
hospital!".format(patient.name))
elif patient and patient.admitted:
print("Patient {} is still undergoing
treatment!".format(patient.name))
else:
print("Patient not found!")

def recover_patient(self, name):


patient = self.find_patient_by_name(name)
if patient and patient.admitted:
patient.recovered = True
print("Patient {} has recovered and can be
discharged!".format(patient.name))
elif patient:
print("Patient {} is not admitted to the hospital
yet!".format(patient.name))
else:
print("Patient not found!")

def find_patient_by_name(self, name):


for patient in self.patients:
if patient.name == name:
return patient
return None
This program defines two classes: Patient and Hospital. The
Patient class represents a patient and contains attributes for
the patient's name, age, gender, symptoms, admission status, and
recovery status. The Hospital class represents the hospital and
contains methods for registering patients, admitting them,
discharging them, and marking them as recovered.

Here's an example of how this program could be used:

python
hospital = Hospital()

hospital.register_patient("John Smith", 45, "Male", "Fever,


Cough")
hospital.register_patient("Jane Doe", 32, "Female", "Headache,
Fatigue")

hospital.admit_patient("John Smith")
hospital.recover_patient("John Smith")
hospital.discharge_patient("John Smith")

hospital.admit_patient("Jane Doe")
hospital.recover_patient("Jane Doe")
hospital.discharge_patient("Jane Doe")

In this example, we create a Hospital object and register two


patients with the register_patient() method. We then admit John
Smith to the hospital using the admit_patient() method, mark him
as recovered using the recover_patient() method, and discharge
him using the discharge_patient() method. We repeat the same
process for Jane Doe. The output of the program should be:

css
Patient John Smith registered successfully!
Patient Jane Doe registered successfully!
Patient John Smith admitted to the hospital!
Patient John Smith has recovered and can be discharged!
Patient John Smith discharged from the hospital!
Patient Jane Doe admitted to the hospital!
Patient Jane Doe has recovered and can be discharged!
Patient Jane Doe discharged from the hospital!
Of course, this is just a simple example and a real hospital
system would be much more complex, but hopefully, this gives you
an idea of how Python could be used to

Example: 2

here's an example Python program for a school attendance


application:

python

class Student:

def __init__(self, name):

self.name = name

self.attendance = []

def mark_attendance(self, status):

self.attendance.append(status)

class Attendance:

def __init__(self, date):

self.date = date

self.students = []
def add_student(self, name):

student = Student(name)

self.students.append(student)

def mark_student_attendance(self, name, status):

for student in self.students:

if student.name == name:

student.mark_attendance(status)

print("Attendance marked for student {} on {} as


{}".format(name, self.date, status))

break

else:

print("Student not found!")

def print_attendance_report(self):

print("Attendance report for date {}:".format(self.date))

for student in self.students:

attendance_status = " ".join(student.attendance)

print("Student {} - {}".format(student.name,
attendance_status))
This program defines two classes: Student and Attendance. The
Student class represents a student and contains attributes for
the student's name and attendance. The Attendance class
represents the attendance of students for a particular date and
contains methods for adding students, marking their attendance,
and printing a report of the attendance.

Here's an example of how this program could be used:

python

attendance = Attendance("2023-03-12")

attendance.add_student("John")

attendance.add_student("Jane")

attendance.add_student("Mark")

attendance.mark_student_attendance("John", "Present")

attendance.mark_student_attendance("Jane", "Absent")

attendance.mark_student_attendance("Mark", "Present")

attendance.print_attendance_report()

In this example, we create an Attendance object for a particular


date and add three students with the add_student() method. We
then mark the attendance of each student with the
mark_student_attendance() method and pass in their name and
attendance status ("Present" or "Absent"). Finally, we print a
report of the attendance with the print_attendance_report()
method. The output of the program should be:
rust

Attendance marked for student John on 2023-03-12 as Present

Attendance marked for student Jane on 2023-03-12 as Absent

Attendance marked for student Mark on 2023-03-12 as Present

Attendance report for date 2023-03-12:

Student John - Present

Student Jane - Absent

Student Mark - Present

Again, this is just a simple example and a real school attendance


system would be much more complex, but hopefully, this gives you
an idea of how Python could be used to implement such a system.

You might also like