Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1. What is a Constructor? What are the different types of Constructors in Java? Can we have default and parameterized Constructors in same class? Explain

Q1. What is a Constructor? What are the different types of Constructors in Java? Can we have default and parameterized Constructors in same class? Explain the concept with the help of an example.

Q2. Program to calculate the Electricity bill of the consumer for one month, as per the tariffs given below: For Units up to 100 units: 80 paise / unit More than 100 up to 200 units: Re. 1.25 / unit More than 200 units: Rs. 2 / unit In addition to the above-mentioned charges, every consumer has to pay Rs. 80 as Service Charge per month. Implement the program using Class and Objects.

Q3. Create a class named 'Employee' with data members (Name, Age, mobile number, Address, Salary) and one method to print all the details. Write a program to create classes 'HOD' and 'Faculty' having data members 'Specialization' and 'Qualification' respectively and inherits 'Employee' class. Enter the details for all the data members from the user and then print the details using Classes and Objects.

Q4. Write a program using Classes and Objects to enter the values of three sides of a triangle and check whether it forms a triangle or not. If it forms a triangle, then check whether the triangle formed in an equilateral, isosceles or a scalene triangle.

Q5. Define a class Library with data members to hold values for account number, title of the book, name of the author. Write a program to input the values of the data members from the user and implement method, to accept the number of days late in returning of books, calculate and display the fine charged the rate of Rs. 2.50 per day. Display the output as per the format given below:

Accession-number Title Author Fine(Rs.)

........................ ........................ ...................... .....................

Write the main method to create an object of the class and call the member methods.

Q6. Create a class Movie with data members to store the year of release of a movie, title of the movie, popularity rating of the movie. (minimum rating = 0.0 and maximum rating = 5.0). Create methods to enter the details of the movie with rating message to be displayed as given below:

0.0 to 2.0 - Flop

2.1 to 3.4 - Semi-hit

3.5 to 4.5 - Hit

4.6 to 5.0 - Super Hit

Use Single Inheritance to implement the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

Will the product fill an unsatisfied need in the market place?

Answered: 1 week ago