Data members/Instant variables: name, empno, basic, da, hra, pf, gross, netThis Java program defines an Employee class with methods to compute gross and net salary based on basic pay. It uses a parameterized constructor for initialization and displays the results in a formatted way. Read more
Data members/Instant variables: name, empno, basic, da, hra, pf, gross, net Member methods: i) A parameterized constructor to initialize the data members hra = 15% of basic pf = 12% of basic gross = basic + da + hra net = gross - pf iv) To display the name, empno, gross salary, net salary. |
||||||||||
Data members/instant variables: max, min, f1, f2;This Java program defines a Temperature class to convert maximum and minimum temperatures from Celsius to Fahrenheit using a parameterized constructor, a computation method, and a display method. The main method demonstrates the functionality with example input. Read more
Data members/instant variables: iv) To display the maximum and minimum temperatures in Fahrenheit. |
||||||||||
Write a program a class with the following specifications: Class name: latinThis Java program converts each word in a string to Pig Latin form using a class Latin with methods for input and processing. It handles vowels, consonants, and words without vowels appropriately. Read more
Class name: latin Data member: void input(String name): to accept a name, convert and print each word input piglatin form. |
||||||||||
Write a class program by using a class with the following specifications: Class name: primeThis Java program determines whether a number is prime using a class Prime with a constructor, an input method, and a method to check and display the result. Read more
Class name: prime Data members/Instant variables: void input(int x): to assign n with z void display( ): to check and print whether number n is prime or not. |
||||||||||
Write a class program with the following specifications: Class name: factorialThis Java program calculates the factorial of a number using a class Factorial with methods to input a number, calculate the factorial, and display the result. Read more
Class name: factorial Data members: void input(int m): to assign a with m. void display( ): to print the factorial of the number. |
||||||||||
Define a class called ‘Mobike’ with the following specifications:This Java program calculates rental charges for a Mobike based on the number of days rented, following specific rate rules. It allows input of customer details and displays a formatted summary of charges. Read more
Data members/Instant variable: int phno: To store the phone number of the customer Srting name: To store the name of the customer int days: To store the number of days the bike is taken out on rent int charge: To calculate and store the rental charge void compute( ): To compute the rental charge The rent for a mobike is charged on the following basis: For first five days: Rs. 500 per day For next five days: Rs. 400 per day Rent of the days: Rs. 200 per day void display( ): To display the details in the following format: Bike No. Phone No. Name No. of days Charge xxxxx xxxxxx xxxxxx xxxxxx xxxxxx |
||||||||||
Hero Honda has increased the cost of its vehicles as per the type of the engine using the following criteria:This Java program calculates the new cost of a Honda vehicle based on its engine type (2-stroke or 4-stroke) using specified increment rates. It includes methods for input, calculation, and display of the results. Read more
Class name: Honda Data members/Instant variables: int cost: To accept previous cost. void find( ): To find the new cost as per the criteria given above. void printcost( ): To print the type and new cost of the vehicle. |
|
Type of Engine |
Rate of Increment |
|
2 stroke |
10% of the cost |
|
4 stroke |
12% of the cost |
Read Answer
This Java program calculates the interest and total amount payable for a vehicle loan based on the duration using specified interest rates. It includes methods to input data, calculate values, and display results.
Read more|
Number of years |
Rate of interest |
|
Up to 5 years |
15% |
|
More than 5 and up to 10 years |
12% |
|
Above 10 years |
10% |
Write a program to model a class with the specifications as given on the next page:
Read Answer
This Java program manages a bookseller's stock. It verifies book availability by matching the title, author, and publisher and processes purchase requests based on stock availability.
Read more
This Java program calculates the fine for a book based on how many days it is overdue, using a defined rate schedule. The fine is calculated based on the first 7, 8-15, 16-30, and more than 30 days of overdue periods.
Read more
|
Days |
Fine |
|
First seven days |
25 paise per day |
|
Eight to fifteen days |
40 paise per day |
|
Sixteen to thirty days |
60 paise per day |
|
More than thirty days |
80 paise per day |
This Java program calculates the simple interest and total amount to be paid based on the principal, rate of interest, and time provided by the user. It displays the results with interest rates adjusted based on the time period.
Read more|
Time |
Rate of Interest |
|
For 1 year |
6.5% |
|
For 2 years |
7.5% |
|
For 3 years |
8.5% |
|
For 4 years or more |
9.5% |
This Java program calculates the telephone bill for a customer based on the number of calls made, applying specific rates, and adds a fixed monthly rent of Rs. 180 for the service.
Read more|
Calls made |
Rate |
|
Up to 100 calls |
No charge |
|
For the next 100 calls |
90 paise per calls |
|
For the next 200 calls |
80 paise per calls |
|
More than 400 calls |
70 paise per calls |
Read Answer
This Java program calculates the discount on an article based on its cost and displays the name of the customer, the discount, and the final amount to be paid after applying the discount.
Read more|
List Price |
Rate of Discount |
|
Up to Rs. 5,000 |
No discount |
|
From Rs. 5,001 to Rs. 10,000 |
10% on the list price |
|
From Rs. 10,000 to Rs. 15,000 |
15% on the list price |
|
Above Rs. 15,000 |
20% on the list price |
Read Answer
This Java program defines an Employee class that accepts the employee's PAN number, name, and annual taxable income. It then calculates the income tax based on predefined income tax slabs and displays the employee’s details along with the calculated tax.
Read more|
Total Annual Taxable Income |
Tax Rate |
|
Up to Rs. 1,00,000 |
No tax |
|
From Rs. 1,00,001 to Rs.
1,50,000 |
10% of the income exceeding Rs.
1,00,000 |
|
From Rs. 1,50,001 to Rs.
2,50,000 |
Rs. 5000+20% of the income
exceeding Rs. 1,50,000 |
|
Above Rs. 2,50,000 |
Rs. 25000+30% of the income
exceeding Rs. 2,50,000 |
Read Answer
This Java program defines a class Triplet that accepts three numbers, checks if they satisfy the Pythagorean theorem (i.e., whether they form a Pythagorean triplet), and displays the appropriate message.
Read moreRead Answer
This Java program defines a class Vowel to accept a string from the user, count the number of vowels in it, and display the total number of vowels found.
Read moreRead Answer
This Java program defines a class CaseConvert to accept a string from the user and convert all uppercase letters to lowercase and vice versa, then display the converted string.
Read moreRead Answer
This Java program defines a class StringMainp that accepts a string and reverses each word in the string. The reversed string is then printed out.
Read moreRead Answer
This Java program defines a Son class that accepts 10 integers, sorts them using selection sort, and allows the user to search for a number in the sorted array using binary search.
Read moreRead Answer
This Java program defines a Calculate class that calculates the sum and difference of two user-inputted numbers. The program includes methods for inputting data, performing calculations, and displaying the results.
Read more