To accept the perpendicular and base of a right-angled triangle.This Java program accepts the lengths of the perpendicular (height) and base of a right-angled triangle. It calculates the hypotenuse using the Pythagorean theorem, computes the area using the formula ( Area = 1 2 × base × height ) (Area= 2 1 ×base×height), and determines the perimeter by summing the lengths of all three sides. Finally, it displays the results to the user. Read more
Read Answer
|
To accept the number of days and display the result after converting it into the number of years, number of months and the remaining number of days.This Java program accepts a number of days as input from the user and converts it into an equivalent duration expressed in years, months, and remaining days. The program performs the conversion based on the assumption that a year has 365 days and a month is approximately 30 days. Read more
Read Answer
|
Write a program In Java to calculate the discount, if a customer purchases a Laptop and a Printer.This Java program calculates the discount on a Laptop (15%) and a Printer (10%) based on their prices entered by the user. It then displays the discount amount and the final prices after applying the discounts. Read more
On Printer: Discount - 10% |
Accept the marks of a student in Physics, Chemistry and Biology. Display the total marks and average marks.This Java program accepts the marks of a student in Physics, Chemistry, and Biology. It then calculates the total marks and average marks based on the input provided. Read moreWrite a program to accept the marks of a student
in Physics, Chemistry and Biology. Display the total marks and average marks. |
Find the difference between Simple Interest and Compound Interest when Principal, Rate and Time are given.This Java program calculates the difference between Simple Interest (SI) and Compound Interest (CI) for a given principal amount, annual interest rate, and time period (in years). The Simple Interest is calculated using the formula: SI = � × � × � 100 SI= 100 P×R×T The Compound Interest is calculated using the formula: CI = � ( 1 + � 100 ) � − � CI=P(1+ 100 R ) T −P The program then computes and displays the difference between the two interest cal Read moreWrite
a program to find the difference between Simple Interest and Compound Interest
when Principal, Rate and Time are given. |
Write a program to find the area and circumference of a circular ring where outer and inner radii are 21 cm. and 14 cm.This Java program calculates the area and circumference of a circular ring, which is defined by its outer radius (21 cm) and inner radius (14 cm). The area is determined by subtracting the area of the inner circle from the area of the outer circle, while the circumference is based solely on the outer radius. Read more
Read Answer
|
Write a program to find the area, perimeter and diagonal of a rectangle.This Java program prompts the user to enter the length and width of a rectangle and then calculates the area, perimeter, and diagonal. The area is computed as the product of length and width, the perimeter is twice the sum of the length and width, and the diagonal is calculated using the Pythagorean theorem. Explanation of the Formulas: Area: Area = Length × Width Area=Length×Width Perimeter: Perimeter = 2 × ( Length + Width ) Perimeter=2×(Length+Width) Diagonal: Diagon Read more
Read Answer
|
Write a program to find the sum, difference and product of two numbers.This Java program prompts the user to input two numbers and then calculates and displays their sum, difference, and product. It utilizes the Scanner class for user input and performs basic arithmetic operations to derive the results. Read more
Read Answer
|
If the values of the variables are: p = 7, q = 9, r = 11; a) p* (q++ % 4)*(++r), b) (r--)% 5 + (r++ /5)*p, c) p+ = (--p + 5)*(p++)*(r/2), d) q* = 5 + (--q)*(q++) + 10Let's evaluate the expressions step by step using the provided values: � = 7 p = 7p=7 � = 9 q=9 � = 11 r=11 Read more
a) p* (q++ % 4)*(++r) |
Evaluate the following expressions. If the values of the variables are: a = 2, b = 3, c = 9; a) (b++)*(--c) & b) a*(++b)% cLet's evaluate the given expressions step by step, using the values: � = 2 a=2 � = 3 b=3 � = 9 c=9 Read more
a) (b++)*(--c) |
Int a = 0, b = 30, c = 40; a = --b + c++ + b & System.out.printIn(“a = ” + a);Let's break down the provided Java code step by step, including how the operations affect the values of the variables. Read more
Read Answer
a = --b + c++ + b System.out.printIn(“a = ” + a); |
What will be the output when: a) val = 500 int val, sum, n = 500; sum = n + val > 1750? 400:200 System.out.printIn(sum); b) Val = 1500Let's analyze each of the given Java code snippets step by step, along with their expected outputs. Code Snippet (a) int val = 500; int sum, n = 500; sum = n + val > sum = n + val > 1750 ? 400 : 200; System.out.println(sum); System.out.println(sum); Read more
Read Answer
a) val = 500 int val, sum, n = 500; sum = n + val > 1750? 400:200 System.out.printIn(sum); b) Val = 1500 |
If m = 5, n =2; what will be the output of m and n after execution? m - = n; & n = m + m/n;Let's analyze the provided operations step by step, given the initial values � = 5 m=5 and � = 2 n=2. Step 1: Perform m -= n The operation m -= n is equivalent to m = m - n. Calculation: � = 5 − 2 = 3 m=5−2=3 Updated Value: � = 3 m=3 � = 2 n=2 Read more |
What will be the output, if x = 5?To determine the output when x = 5, we need to clarify what operations or expressions are being performed with x. However, since you haven't specified any particular expression, I'll cover a few common examples involving x. Read more
Read Answer
|
Distinguish between: a) Unary & Binary arithmetical operator b) Increment & Decrement operator c) / and % operator d) Postfix and Prefix increment e) Postfix and Prefix Decrement f) = and = = g) (p! = q) and !(p = = q)Distinction Between Operators in Java a) Unary & Binary Arithmetic Operator: Unary Arithmetic Operator: Unary operators operate on a single operand. They can perform operations like negation or increment/decrement. Read more
Read Answer
|
What do you understand by Bitwise operator? Explain.Bitwise Operators in Java Definition: Bitwise operators are used to perform operations on the individual bits of integer types (such as int, long, byte, and short). These operators directly manipulate the binary representation of numbers, allowing for efficient low-level programming and manipulation of data. Read more
Read Answer
|
Explain the following with an example each: a) Arithmetic operator b) Relational operator c) Logical operator d) Ternary operatora) Arithmetic Operator Definition: Arithmetic operators perform mathematical operations such as addition, subtraction, multiplication, division, and modulus. Read more
Read Answer
a) Arithmetic operator b) Relational operator c) Logical operator d) Ternary operator |
Distinguish between Operator and Expression.Distinction Between Operator and Expression Operator: Definition: An operator is a symbol that performs a specific operation on one or more operands (variables or values). It manipulates the data by performing actions like addition, comparison, or logical operations. Example: In the statement a + b, the + is the operator that adds two values. Read more
Read Answer
|
What is an Operator?What is an Operator? In Java (and most programming languages), an operator is a symbol that performs operations on variables and values. Operators are used to perform actions such as arithmetic calculations, comparisons, logical operations, and more. They act on variables or data to produce a result. Read more
Read Answer
|
If a = 48, b = 13; find the value of a+ = b++ * 5/a++ + b;Let's break down the expression a+ = b++ * 5 / a++ + b step by step, given that: � = 48 a=48 � = 13 b=13 Read more
Read Answer
|