Write a program in Java to accept a number and check: a) whether the number is divisible by 2 & 5, b) whether the number is divisible by 2 but not by 5, c) whether the number is divisible by 5 but not by 2This Java program accepts a number from the user and checks whether the number is divisible by both 2 and 5, by 2 but not 5, or by 5 but not 2. It then displays the result accordingly. Read more
a) whether the number is divisible by 2 & 5 |
||||||||||||
Accept the cost price and the selling price of an article and calculate either profit percent or loss percent.This Java program calculates either the profit percentage or the loss percentage based on the cost price and selling price of an article entered by the user. Read more
Read Answer
|
||||||||||||
Accept three angles of a triangle and check whether the triangle is possible or not. If possible then check whether it is an acute-angled, a right-angled or an obtuse-angled triangle and display the message accordingly.This Java program accepts three angles of a triangle and checks if the triangle is valid. If valid, it determines whether the triangle is acute-angled, right-angled, or obtuse-angled and displays the result accordingly. Read more
Read Answer
|
||||||||||||
Calculate the value of sin 30° (degree), cos 30° (degree) and tan 30 (degree). Now, display the lowest value of the trigonometrical ratios.This Java program calculates the trigonometric values of sine, cosine, and tangent for 30 degrees, then determines and displays the lowest value among them. Read more
Read Answer
|
||||||||||||
Mr. Guha wishes to accumulate 3000 shares of a company.This Java program calculates how many shares Mr. Guha currently holds based on his annual dividend and how many additional shares he needs to purchase to reach his target of 3000 shares. The program takes the annual dividend as input and computes the results using a formula. Read more
|
||||||||||||
A shopkeeper offers a 30% discount on purchasing articles whereas the other shopkeeper offers two successive discounts of 20% and 10% for purchasing the same articles.This Java program compares the discount offers from two shopkeepers on a given article price. It calculates the final prices after applying a 30% discount from the first shopkeeper and two successive discounts of 20% and 10% from the second shopkeeper. The program then displays which offer is more advantageous for the customer. Read more
Read Answer
|
||||||||||||
Calculate the amount after three years, taking the sum as an input. A = P (1 + R1/100) (1 + R2/100) (1 + R3/100)This Java program calculates the total amount after three years of investment with varying compound interest rates: 5% for the first year, 8% for the second year, and 10% for the third year. The program takes the initial sum as input from the user and applies the compound interest formula to compute the final amount. Read more
[Hint: A = P (1 + R1/100) (1 + R2/100) (1 + R3/100)] |
||||||||||||
A shopkeeper offers a 10% discount on the printed price of a Digital Camera.This Java program calculates the final amount a customer has to pay for a Digital Camera after applying a 10% discount on the printed price and adding a 6% sales tax on the discounted price. The program prompts the user for the printed price and outputs the discount amount, price after discount, sales tax amount, and total payable amount. Read more
Read Answer
|
||||||||||||
Write a program in Java to calculate: a) the interest for the first year, b) the interest for the second year, c) the amount after three years. Take sum as an input from the user.Here’s a Java program that calculates the compound interest for each of the first two years and the total amount after three years for an investment made at a compound interest rate of 5% per annum. The user is prompted to input the initial investment amount. Read more
a) the interest for the first year |
||||||||||||
Write a Menu-driven program to find the area of an Equilateral triangle, an Isosceles triangle and a Scalene triangle as per the User’s choice. (Incomplete question)Here's a complete Java program that is menu-driven, allowing the user to choose to calculate the area of an Equilateral triangle, an Isosceles triangle, or a Scalene triangle based on their input. The program prompts the user for the required dimensions based on their choice and calculates the area accordingly. Read more
Read Answer
|
||||||||||||
Calculate and display whether they are ‘Complementary Angles’ or ‘Supplementary Angles’ as per the User’s choiceThis program accepts two angles from the user and determines whether they are complementary (sum is 90°) or supplementary (sum is 180°) based on the user's choice. The user can select the type of check they want to perform, and the program provides the result accordingly. Read moreWrite a program to accept two angles. Calculate
and display whether they are ‘Complementary Angles’ or ‘Supplementary Angles’ as
per the User’s choice. |
||||||||||||
Calculate and display the area, perimeter or diagonal of the rectangle as per the Use’s choice.The program accepts the length and breadth of the rectangle from the user. The user is prompted to choose between calculating the area, perimeter, or diagonal. Based on the choice, the program calculates and displays the result. Read more
Read Answer
|
||||||||||||
Write a program in Java to display the colour of the spectrum (VIBGYOR) according to the User’s choice.This Java program displays a color from the VIBGYOR spectrum based on the user’s input. The user is prompted to choose a number from 1 to 7, and the corresponding color (Violet, Indigo, Blue, Green, Yellow, Orange, Red) is displayed. If the user selects a number outside of the range, an error message is shown. The program uses a switch statement to match the input with the respective color. Read more
Read Answer
|
||||||||||||
Atul Transport Company’s charges for the parcels from Delhi to Kolkata or vice versa as per the given tariffHere is a Java program to calculate the parcel charge for Atul Transport Company based on the given tariff: Explanation: Scanner Class: Used to take input from the user. Input Weight: The program asks the user to enter the weight of the parcel. Read more
|
|
Weight |
Charge |
|
Up to 10 kg |
Rs. 20/kg |
|
For the next 20 kg |
Rs. 10/kg |
|
For the next 20 kg |
Rs. 8/kg |
|
More than 50 kg |
Rs. 5/kg |
Write a program to calculate the charge for a parcel taking the weight of the parcel as an input.
Read AnswerHere is a Java program to calculate the electricity bill based on the given tariff for the Jharkhand State Electricity Board (JSEB): Explanation: Scanner Class: Used to take input from the user. Units Input: The program asks the user to enter the number of units consumed.
Read more|
Units Consumed |
Charges |
|
Up to 100 units |
80 paisa/unit |
|
More than 100 and up to
200 units |
Rs.1/unit |
|
More than 200 units |
Rs.1.25/unit |
Here's a Java program that takes the marks obtained in an examination and displays the corresponding grade based on the criteria you provided:
Read more
|
Marks |
Grades |
|
80% and above |
Distinction |
|
60% or more but less than
80% |
First Division |
|
45% or more but less than
60% |
Second Division |
|
40% or more but less than
45% |
Pass |
|
Less than 40% |
Promotion not Granted |
This Java program calculates the final amount a customer has to pay at a cloth showroom after applying a discount based on the total cost of items purchased. The program prompts the user to enter the total cost and determines the applicable discount rate using specific ranges. It then computes the discount amount and the final price to be paid after the discount is applied, displaying all relevant information to the user.
Read more|
Total Cost |
Discount (in %) |
|
Less than Rs.2,000 |
5% |
|
Rs.2,001 to Rs.5,000 |
25% |
|
Rs.5,001 to Rs.10,000 |
35% |
|
Above Rs.10,000 |
50% |
Write a program to input the total cost and to compute and display the amount to be paid by the customer after availing of the discount.
Read AnswerThis Java program accepts three numbers from the user. It checks if all three numbers are equal. If they are, it displays a message stating that they are equal. If they are not equal, it calculates and displays the greatest of the three numbers.
Read moreThis Java program accepts the lengths of the three sides of a triangle from the user and determines its type: Equilateral Triangle: All three sides are equal. Isosceles Triangle: Two sides are equal. Scalene Triangle: All three sides are different.
Read moreWrite a program in Java to accept the sides of a
triangle and display whether it is an Equilateral or Isosceles or a Scalene
triangle.
This Java program defines an Employee class that calculates the gross pay of an employee based on the following allowances and deductions: Dearness Allowance (DA): 25% of Basic Pay House Rent Allowance (HRA): 15% of Basic Pay Provident Fund (PF): 8.33% of Basic Pay
Read more