Vous êtes sur la page 1sur 1

1.

Create a washing machine class with methods as switchOn, acceptClothes, accept


Detergent, switchOff. acceptClothes accepts the noofClothes as argument & return
s the noofClothes
2.Create a calculator class which will have methods add, multiply, divide & subt
ract
3.Create a class called Student which has the following methods:
i.Average: which would accept marks of 3 examinations & return whether the stude
nt has passed or failed depending on whether he has scored an average above 50 o
r not.
ii.Inputname: which would accept the name of the student & returns the name.
4.Create a Bank class with methods deposit & withdraw. The deposit method would
accept attributes amount & balance & returns the new balance which is the sum of
amount & balance. Similarly, the withdraw method would accept the attributes am
ount & balance & returns the new balance balance amount if balance > = amount or r
eturn 0 otherwise.
5.Create an Employee class which has methods netSalary which would accept salary
& tax as arguments & returns the netSalary which is tax deducted from the salar
y. Also it has a method grade which would accept the grade of the employee & ret
urn grade.
6.Create Product having following attributes: Product ID, Name, Category ID and
UnitPrice. Create ElectricalProduct having the following additional attributes:
VoltageRange and Wattage. Add a behavior to change the Wattage and price of the
electrical product. Display the updated ElectricalProduct details.
7.Create Book having following attributes: Book ID, Title, Author and Price. Cre
ate Periodical which has the following additional attributes: Period (weekly, mo
nthly etc...) .Add a behavior to modify the Price and the Period of the periodic
al. Display the updated periodical details.
8.Create Vehicle having following attributes: Vehicle No., Model, Manufacturer a
nd Color. Create truck which has the following additional attributes:loading cap
acity( 100 tons ).Add a behavior to change the color and loading capacity. Display
the updated truck details.
9.Write a program which performs to raise a number to a power and returns the va
lue. Provide a behavior to the program so as to accept any type of numeric value
s and returns the results.
10.Write a function Model-of-Category for a Tata motor dealers, which accepts ca
tegory of car customer is looking for and returns the car Model available in tha
t category. the function should accept the following categories "SUV", "SEDAN",
"ECONOMY", and "MINI" which in turn returns "TATA SAFARI" , "TATA INDIGO" , "TAT
A INDICA" and "TATA NANO" respectively.
Please zip and upload the files.

Vous aimerez peut-être aussi