All Tech at one spot
Java Project
Volutpat diam ut venenatis tellus in metus. Gravida cum sociis natoque penatibus et magnis dis. Odio pellentesque diam volutpat commodo.
Design a class to overload a function area() as follows:
(a) double area(double a, double b, double c)-with three double arguments,
returns thehttps://techonespot.com/2022/12/design-a-class-to-overload-a-function-area-as-follows-a-double-areadouble-a-double-b-double-c-with-three-double-arguments-returns-the-area-of-a-scalene-triangle-using-the-formula-area/ area of a scalene triangle using the formula:
area=√𝐬(𝐬 − 𝐚)(𝐬 − 𝐛)(𝐬 − 𝐜) where s=(a+b+c)/2
(b) double area(int a, int b, int height)-with three integer arguments, returns the area of a trapezium using the formula: area=1/2*height(a +b)
(c) double area(double diagonal1,double diagonal2)-with two double arguments, returns the area of a rhombus using the formula: area=1/2*diagonal1*diagonal2
Design a class to overload a function sumSeries() as follows:
(i) void sumSeries(int n,double x)-with one integer argument and one double
argument to find and display the sum of the series given below
s=x-x/2+x/3-x/4+x/5…………n terms
(ii) void sumSeries()- To find and display the sum of the following series:
s=1+(1*2)+(1*2*3)+………………..+(1*2*3……*20)
Define a class Employee with the following description:
Instance variables/Data members:
int pan – to store the personal account number
String name – to store the name
double taxincome – to store annual taxable income
double tax – to store the tax that is calculated
Member methods:
Employee()-Default constructor to store null to member data
void input()-fill values in member data pan,name,tax income
void calc()-calculate tax for an employee and store in tax.
void display()- output member data, and also the income after tax deduction
The following chart is given for tax calculation:
Annual taxable income Tax rate
<=100000 No tax
>100000 and <=500000 8% of the income exceeding 100000
>500000 and <=1200000 12% of the income exceeding 500000
>1200000 16% of the income exceeding 1200000
4. Define a class BookFair with the following description:
Instance variables/Data members:
String bname-stores the name of the book.
double price-stores the price of the book
Member methods:
(i) BookFair()-Default constructor to initialize data members.
(ii) void input()-to input and store the name and price of the book.
(iii) void calculate()-to calculate the price after discount. Discount is calculated
based on the following criteria:
Price Discount
Lessthan or equal to Rs.1000 2% of price
Morethan Rs.1000 and lessthan or
equal to Rs.3000
10% of price
Morethan Rs.3000 15% of price
Write a java program to initialize the Seven Wonders of the World along with
their locations in two different arrays. Search for a name of the country input
by the user. If found display the nameof the country along with its wonder,
otherwise display “Sorry Not Found!”
WONDERS TAJMAHAL,GREAT WALL OF CHINA,CHRIST THE REDEEMER,MACHUPICCHU,COLOSSEUM,PETRA,PYRAMID OFGIZA COUNTRIES INDIA,CHINA,BRAZIL,PERU,ROME,JORDAN,EGYPT
Learn the basics and a bit beyond to improve your backend dev skills.
Designer
Learn the basics and a bit beyond to improve your backend dev skills.
Designer