0% found this document useful (0 votes)
3 views8 pages

Tax, HCF, LCM, and Flight Calculators

The document outlines a series of programming steps for various applications, including tax calculation, word count in a sentence, HCF and LCM calculation, flight fuel estimation, hotel check-in and check-out, electricity bill calculation, twin prime checking, magic number identification, and factorial computation. Each application follows a structured approach with methods for input, processing, and output. The steps include initializing variables, taking user input, performing calculations, and displaying results.
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)
3 views8 pages

Tax, HCF, LCM, and Flight Calculators

The document outlines a series of programming steps for various applications, including tax calculation, word count in a sentence, HCF and LCM calculation, flight fuel estimation, hotel check-in and check-out, electricity bill calculation, twin prime checking, magic number identification, and factorial computation. Each application follows a structured approach with methods for input, processing, and output. The steps include initializing variables, taking user input, performing calculations, and displaying results.
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

1.

Step 1: START

Step 2: Initialize pan, name, tax_income, tax

Step 3: input method:

Print “Enter your pan number”

Scan pan

Print "Enter your name"

Scan name

Print "Enter your taxable income"

Scan tax_income

Step 4: calc method:

If tax_income<=100000 then tax=0.0

Else if tax_income>=100001 && tax_income<=150000 then tax=(tax_income-100000)*0.1

Else if tax_income<=150001 && tax_income>=250000 then tax=5000+((tax_income-150000)*0.2)

Else tax=25000+((tax_income-250000)*0.3)

Step 5: display method:

Print “Pan Number\tName\t Tax Income\t Tax”

Print pan, name, tax_income, tax


Step 6: main method:

Create object obj

Call input method, calc method and display method

Step 7: STOP

2. Step 1: START
Step 2: Initialize sen, word, count, temp[]
Step 3: Constructor sentence:
Assign sen=” “
Assign word=””
Assign count=0
Step 4: input method:
Print "Enter the sentence"
Scan sen
Print "Enter the word"
Scan word
Step 5: check method:
Assign temp=split sen
for (int i = 0; i < [Link]; i++)
if [Link](temp[i]) then increase count by 1
Step 6: display method:
Print "The number of times the word "+word+" appears in the sentence: '"+sen+"' is "+count
Step 7: main method:
Create object obj
Call input method, check method and display method
Step 8: STOP
3. Step 1: START
Step 2: Initialize a ,b, hcf, lcm ,m, n
Step 3: Constructor HCF_LCM:
Assign a=m
Assign b=n
Step 4: input method:
Print "Enter the first number"
Scan a
Print "Enter the second number"
Scan b
Step 5: hcf_cal method:
Initialize and assign x=a and y=b
while (y != 0)
{ Initialize and assign t=y
Assign y=x%y
Assign x=t }
Assign hcf=x
Print "The HCF of "+a+" and "+b+" is "+hcf
Step 6: lcm_cal method:
Assign lcm= (a * b) / hcf
Print "The LCM of "+a+" and "+b+" is "+lcm
Step 7: main method:
Create object obj
Call input method, hcf_cal method and lcm_cal method
Step 8: STOP
4. Step 1: START
Step 2: Initialize fl_no, dist, fuel, dest
Step 3: Non parameterized constructor:
Assign fl_no=0
Assign dest=””
Assign dist=0
Assign fuel=0
Step 4: Parameterized constructor (initialize f, de, di):
Assign fl_no=f
Assign dest=de
Assign dist=di
Step 5: calfuel method:
if dist<=1000 then fuel=500
else if dist>1000 && dist<=2000 then fuel=1100
else fuel=2200
Step 6: feedinfo method:
Print "Enter flight number:"
Scan fl_no
Print "Enter destination:"
Scan dest
Print "Enter distance:"
Scan dist
Step 7: showinfo method:
Print "Flight number: "+fl_no
Print "Destination: "+dest
Print "Distance: "+dist
Print "Fuel: "+fuel
Step 8: main method:
Create object obj
Call feedinfo method, calfuel method and showinfo method
Step 9: STOP
5. Step 1: START
Step 2: Initialize Rno, name, Tarrif, amt, NOD
Step 3: Checkin method:
Print "Enter your name:"
Scan Name
Print "Enter the Room no.:"
Scan Rno
Print "Enter the Tarrif:"
Scan Tarrif
Print "Enter the no. of days:"
Scan NOD
Step 4: Calc method:
Assign amt=NOD*Tarrif
If Tarrif>10000 then amt=1.050f*amt
Print "Amount:"+amt
Step 5: Checkout method:
Print "Name:"+Name
Print "Rno:"+Rno
Print "Tarrif:"+Tarrif
Print "NOD:"+NOD
Step 6: main method:
Create object obj
Call Checkin method, Calc method and Checkout method
Step 7: STOP
6. Step 1: START
Step 2: Initialize name, id, units, amount
Step 3: read method:
Scan name, id, units
Step 4: calc method:
if units <= 50 then amount = units * 0.75
if units > 50 && units <= 200 then amount = ((50 * 0.75)+(units - 50)*1.25)
if units > 200 && units <= 400 then amount = ((50 * 0.75)+(150 * 1.25)+(units - 200)*2.25)
if units > 400 then amount = ((50 * 0.75)+(150 * 1.25)+(200 * 2.25)+(units - 400)*3.0)
Assign amount=amount*1.18
Step 5: print method:
Print name
Print id
Print units
Print amount
Step 6: main method:
Create object obj
Call read method, calc method and print method
Step 7: STOP
7. Step 1: START
Step 2: prime method:
for(initialize and assign i=2; i<=x/2; i++)
{ if x%i == 0 then return false }
return true
Step 3: main method:
Initialize a, b and scan
if [Link](a-b)==2 then
{ if prime(a) && prime(b) then Print twin prime
else Print not twin prime }
else Print not twin prime
Step 4: STOP
8. Step 1: START
Step 2: parameterized method sumofdigit(int x):
Initialize and assign sum=0
while(x!=0)
{ Assign sum=sum+(x % 10)
Assign x=x/10 }
return sum
Step 3: main method:
Initialize n and scan
Assign k=n
while(n!=0)
{ k = n;
Assign n = sumofdigit(n);
if(n==1) then Print “Magic number"
break}
else if(k==n) Print “Not Magic number”
break; }
return
Step 4: STOP
9. Step 1: START
Step 2: parameterized method fact(int x):
Initialize and assign f=1
for (initialize and assign i=x;i>=1;i--) {
Assign f=f*i; }
return f
Step 3: main method:
Initialize n and scan
Switch case(n){
case 1: initialize and scan k
initialize and assign sum=0
initialize and assign l=10
for(initialize and assign i=0;i<k-1;i++) {
l++;
Assign sum = sum+ l;
l *= 10;
}
Step 4: STOP
10.

You might also like