an
<br>
Definea class employee having
Data Members:
thefollowing description :
int pan :
: tostore personal account number.
Instance variables
String name : to store name.
double tax income : to store annual
taxable income.
double tax : to store tax
that is calculated.
Member functions :
input() : Store the pan number, name,
taxable income.
calc() : Calculate tax for an employee.
display() :Output details of an employee.
Write a program to Compute the tax according to the given conditions and display
the output as per given
format.
Total Annual Taxable Income Tax Rate upto ? 1,00,000 No Tax
From ? 1,00,001 to ? 1,50,000 10% of the income exceeding 1,00,000
From 1,50,001 to 2,50,000 75000 + 20%.of the income exceeding ? 1,50,000
Above 2,50,000 25,000 + 30% of the income exceeding 2,50,000
Output
Pan Number Name Tax-Income Tax
<br>
66. Define a class named Fruit]uice with the following description :
:
Instance variables/data members
int product_code stores the product code number.
-
String flavour stores the flavour of the juice (E.g. orange, apple, etc.).
String pack type stores the type of packaging (E.g. tetra-pack, PET bottle, etc.).
int pack_size – stores package size (E.g. 200 ml, 400 ml, etc.).
int product_ price – stores the price of the product.
Member methods :
) Fruitjuice)- Default constructor to initialize integer data members to 0 and String data members
to "".
(i) void input()-To input and store the product code, lavour, pack type, pack size and product price.
(i) void discount()-To reduce the product price by 10.
(iv) void display()-To display the product code, flavour, pack type, pack size and product price.
7. Design a class to overload a function Sum( ) as follows:
<br>
– sumn of all the even
(i)int Sum(int A, int B) with two integer arguments (A and B) calculate and return
numbers in the range of A and B.
Sample input: A = 4 and B = 16
Sample output: sum =4 +6+8+10 12 14 16
+ + +
(ü) double Sum(double N) - with one double arguments(N) caleulate and return the product of the
following series:
Sum =1.0x 1.2 x 1.4 x .xN
(ü) int Sum(int N) - with one integer argument (N) calculate and return sum of only odd digits of the
number N.
Sample input: N=43961
Sample output: sum =3+9+1=13
Write the main method to create an object and invoke the above methods.
<br>
78. Define a class Account, with following specifications:
Members Member Name Description
private data members ac_num Stores account number
ac_name Stores account holders name
bal Store balance amount in the account
constructor To initialise all private data members to 0 (zero)
public methods getValues() To store data
display() To display the data
deposit() To modify balance according deposited
withdrawl()
to the amount
To modify balanceaccording
Assume that above iobe koo to
L
to withdrawn amount.
<br>
S0. A private Cab service company provides service within
the city at the following rats: Bozna QIeStion
ACCAR NON AC CAR
Up to 5 Km Z150/
<120/
Beyond 5 Km 10/- Per Km 08/- Per Km
Design a class CabService with the following
description:
Member variables /data members:
String Car-type To store the type of car (AC or NON AC)
double km To store the kilometer travelled
double bill To calculate and store the bill amount
Member methods :
CabService() Default constructor to initialise data mennbers.
String data members to "" and double data membes to 0.0.
void accept() - To accept car_type and km (using Scanner class only).
void calculate() - To calculate the billas per the rules given above.
void display() - Todisplay the billas per the following format
CAR TYPE:
KILOMETER TRAVELLED: TOTAL BILL:
Create an object of the class in the main method and invoke the member mettks
<br>
51. Define a class BankAccount that is described below :
Members Member Names Description
Instance variables AcNumb, AcName Store account number, holder'sname and balance.
Default Constructor Initialise AcNum, AcName and AcBalance.
Parameterised Initialise AcNu7m, AcName and AcBalarnce with values
Constructor accepted from object.
52. Create the following class as per given specification:
<br>
Class name: Salecom
Data Members:- private double sale,com
Member methods:
Salecom(double s, double c):constructor to initialise sale and
void display() : to display sale and commission
void commission(): to calcutale the commission as based on the following table:oe
Sale Commission
uptoRs. 1,000 5% on sale
Rs. 1,001 to Rs. 2,000 10% on sale
Rs. 2,0001 and above 15% on sale
2 Write a program to input integer elements into an array of size 20 and perform the following operations:
<br>
(0) Display largest number from the array.
(i) Display smallest number from the array.
(iü)Display sum of all the elements of the array.
<br>
114. Write a menu driven program to perform the following
operationsas per user's choice:
() Toprint the value of C= a2 [Board Question]
+2ab, where a varies from 1.0 to 20.0 with increment of
Constant. 2.0andb=3.0 is a
(i) To display the following
pattern using for loop:
A
AB
ABC
ABCD
ABCDE
Display proper message for an invalid choice.
.Mite a program toinput a string and convert it to
<br>
uppercase and print the pair of vowels and number
of pair of vowels occurring in the string t.
Example:
Input:
"BEAUTIFUL BEAUTIES"
Output:
Pair of vowels EA, AU, EA,AU, IE
:
No. of pair of vowels: 5.
<br>
sentence and print e number of characters
.Nrite a program to inputa bund in
telngast
ven sentence.
nta
Por example :if $="ndia is my country" then the output should be7
63. Write a program to input any given string to calculate the total number of characters and
<br>
andvowels
Pe%,
in the string and also reverse the string:
Example :
INPUT:
Enter string: SNOWY
OUTPUT:
Total number of characters :05
Name of vowels: 01
Reserve string :YWONS
<br>
alass Enploy ee having
Deßinea.
descaip tion.
tioo
tho falla
Data Mermber&i
int pan to_stae TxraNeni Netet
sting nQme
double taxincome anoualtorahle lotah
double tox to gt-e calculaded tax
|Memberunothions.
oid input C)to
inpütnavey Pa, tnxoble
to
Noid
calculatetx
display C)-outputeletails ß enplo ee.
Calculate tox based.
givenonditions.
TotaliAnnwalTaxoble' Incane
Tox Rate
pt. RA R,50,_000
No tex
mRs. 2,50,00 to
5,00,000
Rs. 2,50_, o00
EooRs. 5,00,00 t (o,00,00 come prt
30, 000+. fin
Rs.5,00,000
Above intoc
[Link], 00, 000 50 ,000 +
30/ cß the
erceeclihg Ro. lo, 00,000
<br>
DATE: 202
3.
PTDC-,a Couoier compangchaieb 6or tfecouterwitR
bgse cl weipit o6 [Link]ßine
. a-closs
speciGicatione
te following
Couaie
class hame3
e CcLsturmer
ham
wejpkt. weght o6-parcel in kilegroms
addes3. adol>esE_oß ecepient
bil amount to bepaid
type D'-dormesti. 1'-international
MemberMethocle
atoid accept ()-to accept the defailsusibg method
eß Scanner/claS9 only
caloala te per Golloaig Caiteig
Lyoid calculate C)- tu billLas
Rate pe
weightsin ks
R. Go.
Atat 5 kg
Nexf5kg RacO0
Rs. 50V
AboveI0 kg
iß
Qddlittonal ramo unt fRA 1500 is charged
the cocier is_I Cin ternational)
vojd paint ) fo piat the details.
Noid mainC)-foCheatean -ahjeet oß class and invake
oethod
RO
<br>
DATE: 202
6)
[Link] inaa Ja to Store certain valueg in
wße tâer
Bese huo matn equal
Eg A
1
3
6 1
2
2
Qutput
Theg tin equal
PAGE Ro
<br>
DATE: 202
and
aAP to Sum af selernents in ipht
Jeit diagonal Squae mataix,
<br>
PAGE No
DATE: 202
APto cheate 8quate matik and paiot
L
its transpoße along cwitß corigin almatis
1
2 8
6 2 5
5
3
<br>
FAGE No
DATE:!
3 WAP Stote value
store
Aieent aitay
and alie ot ara
Fallouang
form:
PC1 REI
5 2
4 5
15
20 Lo
25
30 5.
25
30
<br>
PAGE No
DATE: I 202
Pll .WAP Cheate
Landcßeck ßethexit is
A mahix is Said to be aynênhie
if aLi,ilE a
1
5
14
2 |4
PAGE N9
<br>
DATE:
| 202
WAP java o ead Senfence om uBeE,
(onyert it into upperca&e. Toint t6ose
words ohick
stort lwith
Volwel
<br>
PAGE No
DATE:
202
in Java to ead Sen tebce Som
tat wbichdo not co
toin Yowe
<br>
wAP in to input
PAGE No
DATE:
indeger valueg Qnd Squae
eVerse matiz with
eac6 element
stoe \alue ond
matrix
e8caltapt Display
the
ACI
26 I72 62 l6
233 45 27| 332 12
6
72 5 54 64
<br>
PAGE No
DATE:
I 202
java to talke
-and pint
aBenttnce
Nooels in pach
Toput
Tadia coLun hay
|Output
Ioalia 3
County 2
<br>
PAGE No
DATE: | 202
AAP ot the g£
in Jaua to ead thename
Surnamen
by
Gad initialsof hame ollbaoed
paint the
PAGE No
<br>
202
DATE:
Ond
WAP
paint a
toet
new seotenoe
Sendencefo
with
af fe eplacing Vowel
o
hext Vowe
<br>
PAGE No
DATE: 202
NAP Java t ad
pžint sEoteDce_after emOvÍg
h
wfose posihon wil be giueo
<br>
PAGE
APin ava
No
DATE:
| 0
Congole
et in douer
and pnnt the cßaracler uhth.
0ccked
<br>
AP
PAGE KO
longcst city namp
<br>
Take input, fom v ser
Kaoay Spcid Bopsana (PSe)
[Link] infa andcreate on on find
tfe.
Special gtose itin
humbegnd and8toe it n-peuaro
2.3 waitea hgaat..cHeae..ashi aay rd The
\uiqueahihand &toe t in G new
[Link] stig aay
chHea te
and print e
name afcithiesufieheda.
4. WAP jo Java toceae a
Sttn anny ad petinpt
oer a..newanay whose element& ae
Ceak
Shingfomed umfsst 2anel last2le Hexs af
-previosagy
BC1
Apple Aple
Elephant Elnt
5. Java to get the values in ahaond
find
tkenivennuabes and-Xylernhumte Qnd
Btoe itih tuoodifdeentammys
6. WAPin avatoinpt a
ckaracer-and conVextit
-ppe)rcase
WAPin Jaa toinput..
to
Londchange it to. numeHe Nalueand gum
Ldigita
tindthe af
andSsoLetihpewanacus.
<br>
Page
WAP inNava
do tie slloesk tasks
)Tnput woral
patem
Outpt
Cxeate
t Dum ber ondnl its sum
Inut
Aqa
Agra Cutput
Bann
AscIIL 6l6 31
Jaipr
613