Professional Documents
Culture Documents
ASSIGNMENT:-1
SUBMITTED BY:
SUBMITTED TO:
DATE:
Question:
Pseudocode
Start
Input salary(S)
Tax% = 0%
Tax% = 6%
Tax% = 8%
Tax% = 12%
Tax% = 16%
ELSE
Tax% = 40%
END IF
A = S- (Tax% * S)
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
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
IF SI > 20 THEN
PRINT “GREATER”
END IF
END
Flowchart:
START
INPUT P
INPUT T
INPUT R
SI=P*T*R
100
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 = []
python
hospital = Hospital()
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")
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
python
class Student:
self.name = name
self.attendance = []
self.attendance.append(status)
class Attendance:
self.date = date
self.students = []
def add_student(self, name):
student = Student(name)
self.students.append(student)
if student.name == name:
student.mark_attendance(status)
break
else:
def print_attendance_report(self):
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.
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()