Você está na página 1de 2

1.

Write a program to find the difference between sum of the squares and the square of the sums of n
numbers?
2. Develop a program that accepts the area of a square and will calculate its perimeter.
3. Develop the program calculateCylinderVolume., which accepts radius of a cylinder's base disk and
its height and computes the volume of the cylinder.
4. Utopias tax accountants always use programs that compute income taxes even though the tax rate is
a solid, never-changing 15%. Define the program calculateTax which determines the tax on the gross
pay. Define calculateNetPay that determines the net pay of an employee from the number of hours
worked. Assume an hourly rate of $12.
5. An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every
performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit
that consumes the number of attendees (of a show) and calculates how much income the show earns.
6. Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its
height and computes surface area of the cylinder.
7. Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open
cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its
wall.
8. Develop the program calculateHeight, which computes the height that a rocket reaches in a given
amount of time. If the rocket accelerates at a constant rate g, it reaches a speed of g · t in t time units
and a height of 1/2 * v * t where v is the speed at t.
9. Develop a program that computes the distance a boat travels across a river, given the width of the
river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the
Pythagorean Theorem is c2 = a2 + b2.
10. Develop a program that accepts an initial amount of money (called the principal), a simple annual
interest rate, and a number of months will compute the balance at the end of that time. Assume that no
additional deposits or withdrawals are made and that a month is 1/12 of a year. Total interest is the
product of the principal, the annual interest rate expressed as a decimal, and the number of years.
Please zip your files and upload it. You can submit only one file.
1. Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent,
switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes
2. Create a calculator class which will have methods add, multiply, divide & subtract
3. Create a class called Student which has the following methods:
i. Average: which would accept marks of 3 examinations & return whether the student has passed or
failed depending on whether he has scored an average above 50 or 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 amount & balance & returns the new balance ‘balance –
amount’ if balance > = amount or return 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 salary. Also it has a method grade
which would accept the grade of the employee & return 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. Create Periodical which
has the following additional attributes: Period (weekly, monthly etc...) .Add a behavior to modify the
Price and the Period of the periodical. Display the updated periodical details.
8. Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create
truck which has the following additional attributes:loading capacity( 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 value. Provide a
behavior to the program so as to accept any type of numeric values and returns the results.
10. Write a function Model-of-Category for a Tata motor dealers, which accepts category of car
customer is looking for and returns the car Model available in that category. the function should accept
the following categories "SUV", "SEDAN", "ECONOMY", and "MINI" which in turn returns "TATA
SAFARI" , "TATA INDIGO" , "TATA INDICA" and "TATA NANO" respectively.
Please zip and upload the files.

Você também pode gostar