Case1 If Diagonally Opposite Chairs Have To Cross Along Edges of Room

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

A1]submitted in handwritten form

A2]
Case1 if diagonally opposite chairs have to cross along edges of room
stand up while true if not

touching something take step

if touching wall
turn left 90 degrees continue

if touching chair
sit down

case2:if diagonally placed chairs and allowed to cross diagonally or are placed
across the room and facing each other

Stand up

While true

If not touching chair

Take step

Else if touching chair

Sit down

A3]input ID number

Input first and last name

Input major field of study

Input grade point average

If grade point average<2.0

Display ID number, first name, last name, major field of study, grade point average

B) input integer rec

i=1 list1=[]

While i<=rec

Input first and last name

Input major field of study

Input grade point average


If grade point average<2.0

Add first and last name to list1


i=i+1 display List1

C)

list1=[]

While True

Input first and last name

Input major field of study

Input grade point average

If grade point average>3.5 and major field of study=>English major

Add first and last name to list1

Input want to continue?

If yes

then continue else

break display list1

a4]submitted in handwritten form

a5]

a]algorithm
STEP1: get account number

STEP2: get customer name, balance due

STEP3: set i as 1

STEP4: set balance due1=balance due

STEP5: show account number, customer name

STEP6: while i<=10, balance due1=balance due1-(balance due*10/100)

STEP7: Show balance due1

STEP8: add 1 to value of i

STEP9: show thank you


Pseudo code:
get account number

get customer name, balance due

set i=1

balance due1=balance due

display account number, customer name while i<=10

balance due1=balance due1-(balance due*10/100

display balance due1

i=i+1

display thank you


flowchart:

Code:accnumber=int(input('Enter account number: ')) custname=input('Enter


name: ') balancedue=float(input('Enter balance due:'))
list1=[accnumber,custname,balancedue] i=1 balancedue1=balancedue
print('Account number is ',accnumber) print('Customer name is ',custname)
while i<=10:
balancedue1=balancedue1-(balancedue*10/100) print('Your
balance due for', i,'month is ',balancedue1 ) i=i+1
print('thank you')

output:
enter account number:85496
enter name:Arjun Narayanan
enter balance due:19000
account number is 85496
CUSTOMER NAME IS ARJUN.NARAYANAN
Your balance due for 1 month is 17100.00

Your balance due for 2 month is 15200.00

Your balance due for 3 month is 13300.00

Your balance due for 4 month is 11400.00

Your balance due for 5 month is 9500.00

Your balance due for 6 month is 7600.00

Your balance due for 7 month is 5700.00

Your balance due for 8 month is 3800.00

Your balance due for 9 month is 1900.00

Your balance due for 10 month is 0.00

thank you

B]

STEP1: while true, get account number

STEP2: if account number is 12345, exit

STEP3: else, get customer name, balance due

STEP4: set i as 1

STEP5: set balance due1=balance due

STEP6: show account number, customer name

STEP7: while i<=10,balance due1=balance due1-(balance due*10/100)

STEP8: Show balance due1


STEP9: add 1 to i

STEP10: show thank you


Pseudo code:
While True

get account number

if account number=12345
break

get customer name, balance due

set i=1

balance due1=balance due

display account number,customer name while i<=10

balance due1=balance due1-(balance due*10/100 display

balance due1 i=i+1

display thank you

flowchart:

code:while True:

accnumber=int(input('Enter account number: '))

if accnumber==12345: #let 12345 be the sentinel value


print('thank
you') break
else:
pass custname=input('Enter name: ')
balancedue=float(input('Enter balance due:'))
list1=[accnumber,custname,balancedue] i=1
balancedue1=balancedue print('Account number
is ',accnumber) print('Customer name is
',custname) while i<=10:
balancedue1=balancedue1-(balancedue*10/100) print('Your
balance due for', i,'month is ',balancedue1 )
i=i+1 print('thank
you')
output:

enter name:arjun.narayanan
enter balance due:20000
account number is 344692
customer name is arjun.narayanan
Your balance due for 1 month is 18000.00
Your balance due for 2 month is 16000.00
Your balance due for 3 month is 14000.00
Your balance due for 4 month is 12000.00
Your balance due for 5 month is 10000.00
Your balance due for 6 month is 8000.00
Your balance due for 7 month is 6000.00
Your balance due for 8 month is 4000.00
Your balance due for 9 month is 2000.00
Your balance due for 10 month is 00.00
thank you
Your balance due for 3 month is 56000.00
Your balance due for 4 month is 48000.00
Your balance due for 5 month is 40000.00
Your balance due for 6 month is 32000.00
Your balance due for 7 month is 24000.00
Your balance due for 8 month is 16000.00
Your balance due for 9 month is 8000.00
Your balance due for 10 month is 00.00
thank you

enter account number:23495


enter name:arjun.narayanan
enter balance due:45000
account number is 23495
customer name is arjun.narayanan
Your balance due for 1 month is 40500.00
Your balance due for 2 month is 36000.00
Your balance due for 3 month is 31500.00
Your balance due for 4 month is 27000.00
Your balance due for 5 month is 22500.00
Your balance due for 6 month is 18000.00
Your balance due for 7 month is 13500.00
Your balance due for 8 month is 9000.00
Your balance due for 9 month is 4500.00
Your balance due for 10 month is 00.00
thank you

You might also like