Posts

Showing posts from May, 2020

Java Program to Find Roots of Quadratic Equation

import java.util.*; class testing {         public static void main(String args[])         {             double d,a,b,c,r1,r2;             Scanner sc=new Scanner(System.in);             System.out.println("Enter a:");             a=sc.nextDouble();             System.out.println("Enter b:");             b=sc.nextDouble();             System.out.println("Enter c:");             c=sc.nextDouble();             d=(Math.pow(b,2))-4*a*c;             if(d>0)             {                 r1=(-b+Math.sqrt(d))/(2*a);                 ...

Write a Program To Input the Marks and Display the Grades Accordingly using if-else in Java

import java.util.*; class Marks {     public static void main(String args[])     {         int m;         Scanner sc=new Scanner(System.in);         System.out.println("Enter the Marks:");         m=sc.nextInt();         if(m>=80)         {             System.out.println("Distinction");         }         else if(m>=60 && m<80)         {             System.out.println("First Division");         }         else if(m>=45 && m<60)         {             System.out.println("Second Division");         }         else if(m>=40 && m<45)   ...

WAP to input the total cost and to compute and display the Amount to be paid after the discount on the cost of purchased items, based on the following criteria:

WAP to input the total cost and to compute and display the Amount to be paid after the  discount on the cost of purchased items, based on the following criteria:         Cost                                            Discount (in percentage) Less than or equal to Rs. 10000                               5% More than Rs. 10000 and less than or equal to Rs. 20000       10% More than Rs. 20000 and less than or equal to Rs. 35000       15% More than Rs. 35000                                           20%*//*WAP to input the total cost and to compute and display the Amount to be paid after the  discount on the cost of purchased it...