Posts

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);                 r2=(-b-Math.sqrt(d))/(2*a);                 System.out.println("1st root="+r1);                 System.out.println("2nd root="+r2);             }             else if(d==0)             {                 r1=-b/(2*a);                 System.out.println("1st root="+r1);             }             else             {                 System.out.println("Imaginary Roots");

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)         {             System.out.println("Pass");         }         else         {             System.out.println("Promotion Not Granted");         }     } }         OUTPUT: Enter the Marks: 90 Distinction YouTube Videos for Explanation https://www.youtube.com/watch?v=aqNaKEncMVE

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 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         

Marquee Tag in Html and Properties of Marquee Tag with Html Code

<!DOCTYPE html> <html> <head> <title>Marquee Tag Example</title> </head> <body> <marquee behavior="scroll" scrollamount="10" direction="right" loop="3">Welcome To Coding Hub</marquee> </body> </html>

LIST Tags in Html

<!DOCTYPE html> <html> <head> <title>Example of List</title> </head> <body> <center><h1>Type of List</h1></center> <!--Order list--> <ol type=a> <li>Ajit</li> <li>Sahbaj</li> <li>Pawan</li> </ol> <ol type=A> <li>Ajit</li> <li>Sahbaj</li> <li>Pawan</li> </ol> <ol type=i> <li>Ajit</li> <li>Sahbaj</li> <li>Pawan</li> </ol> <ol start="10"> <li>Ajit</li> <li>Sahbaj</li> <li>Pawan</li> </ol>   <!--Unorder List--> <ul type="square">     <li>Ajit</li> <li>Sahbaj</li> <li>Pawan</li> </ul> <!--Defination List--> <dl> <dt>Ajit</dt> <dd>he is game De

A Computer Salesman gets commission on the following basis using Java

/*A computer salesman gets commission on the following basis:             Sales                        Commission Rate             Rs. 0 - 20,000                      3%             Rs. 20,000 - 50,000                12%             Rs. 50,001 and more                31% After accepting the sales as input, calculate and print his commission amount and rate of commission.*/ Source code: import java.util.*; class Comm {     public static void main(String args[])     {         double comm=0.0;         int rate=0,sale;         Scanner sc=new Scanner(System.in);         System.out.println("Enter the sales rs:");         sale=sc.nextInt();         if(sale<=20000)         {             rate=3;             comm=sale*0.3;         }         if(sale>=20000 && sale<=50000)         {             rate=12;             comm=sale*0.12;         }         if(sale>=50000)         {             rate=31;             comm=sale*0.31;         }  

Electricity Bill Program:Write a program in JAVA to enter the unit and calculate the amount to bill paid by user

Calculate the Bill as per the following tariff : Number of units Rate per unit 1 - 100 units Rs.5.00 101-200 units Rs.7.00 201-300 units Rs.10.00 Above 300 Rs:15.00 Before we write a program to calculate the electricity bill we must understand electricity charges and rates. /*1 - 100 unit - 5/= 101-200 unit - 7/= 201-300 unit - 10/= above 300 - 15/=*/ Explanation if the unit consumed less or equal to 100 units, calculates the total amount of usage =unit*5 if unit consumed between 100 to 200 units, calculates the total amount of usage =(100*5)+(unit-100)*7) if unit consumed between 200 to 300 units ,calculates total amount of usage =(100*5)+(100*7)+(unit-200)*10 if unit consumed above 300 units ,calculates total amount of usage =(100*5)+(100*7)+(100*10)+(unit-300)*15 No additional charge Source code import java.util