Posts

Showing posts from May, 2020

Create DropDown Box using HTML

<!DOCTYPE html> <html> <head> <title>DropDown</title> </head> <body bgcolor="yellow"> <table align="center"> <tr> <td><label>Select State</label></td> <td> <select class="states" name= "states" style="padding: 10px 10px"> <option value="AP">AndhraPradesh</option> <option value="TS">Telangana</option> <option value="TN">TamilNadu</option> <option value="KT">Karanataka</option> <option value="MH">Maharashtra</option> </select> </td> </tr> </table> </body> </html>

Find Duplicate Character using Java

package com.java.basicprograms; public class DuplicateChar { public static void main(String[] args) { String str = "maheshbabu"; int length = str.length(); char[] ch = str.toCharArray(); for (int i = 0; i < length; i++) { for (int j = i + 1; j < length; j++) { if (ch[i] == ch[j]) { System.out.println("Duplicate characters are:    " + ch[j]); break; } } } } }

Corona Virus Test Using Java

package com.java.basicprograms; import java.util.*; public class CoronaVirusTest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enetr patient symptoms"); String str = sc.nextLine(); String[] word = str.split(" "); boolean isTrue = false; List<String> dList = new ArrayList<String>(); dList.add("cough"); dList.add("fever"); dList.add("tiredness"); dList.add("difficultybreathing"); for (int i = 0; i < word.length; i++) { if (dList.contains(word[i])) { isTrue = true; } else { isTrue = false; } } if (isTrue) { System.out.println("The Patient need to go for Corona Test"); } else { System.out.println("The Patient doesnot have Corona"); } } }

Convert XML In To Java Using Java

package com.java.basicprograms; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class ConvertXMLInToJava { public static void main(String[] args) { try { JAXBContext context  = JAXBContext.newInstance(Item.class); Unmarshaller unmarshaller = context.createUnmarshaller(); File file = new File("E:/item.xml"); Item item = (Item) unmarshaller.unmarshal(file); System.out.println(item); } catch (JAXBException e) { e.printStackTrace(); } } }

Convert JavaObject In To XML using Java

package com.java.basicprograms; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; public class ConvertJavaObjectInToXML { public static void main(String[] args) { Item item = new Item(); item.setItemId(101); item.setItemName("Laptop"); item.setItemDesc("Lenovo Laptop"); item.setItemPrice(25000.0); try { JAXBContext context = JAXBContext.newInstance(Item.class);     Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(item,new File("E:/item.xml")); marshaller.marshal(item, System.out); } catch(JAXBException  e) { e.printStackTrace(); } //Convert XML into Java Object try { JAXBContext context = JAXBContext.newInstance(Item.class); Unmarshaller unmarshaller = context.createUnmar...

Capitalize FirstLetter of each Word using Java

package com.java.basicprograms; import java.util.*; public class CapitalizeFirstLetter { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter String data"); String str = sc.nextLine(); String upperCase = " "; Scanner scaner = new Scanner(str); while (scaner.hasNext()) { String word = scaner.next(); upperCase += Character.toUpperCase(word.charAt(0)) + word.substring(1) + " "; } System.out.println(upperCase.trim()); } }

Develop Calculator Using Java

package com.java.basicprograms; import java.util.*; public class Calculator { public static void main(String[] args) { Double num1, num2, result; Scanner sc = new Scanner(System.in); System.out.println("Enetr num1"); num1 = sc.nextDouble(); System.out.println("Enetr num2"); num2 = sc.nextDouble(); System.out.println("Enter operator"); char operator = sc.next().charAt(0); switch (operator) { case '+': result = num1 + num2; break; case '-': result = num1 - num2; break; case '*': result = num1 * num2; break; case '/': result = num1 / num2; break; default: System.out.println("Entered wrong operator"); return; } System.out.println(num1 + " " + operator + " " + num2 + ":   Result is:" + result); } }

BubbleSort using Java

package com.java.basicprograms; import java.util.*; public class BubbleSort { public static void main(String[] args) { int num, temp; System.out.println("Enetr the nuumber of integers to sort"); Scanner sc = new Scanner(System.in); num = sc.nextInt(); int array[] = new int[num]; System.out.println("Enter the numbers"); for (int i = 0; i < num; i++) array[i] = sc.nextInt(); for (int i = 0; i < num - 1; i++) { for (int j = 0; j < num - i - 1; j++) { if (array[j] > array[j + 1]) { temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; } } } System.out.println("After sorting thr data is:  "); for (int i = 0; i < num; i++) System.out.println(array[i]); } }

BinarySearch Using Java

package com.java.basicprograms; import java.util.*; public class BinarySearch { public static void main(String[] args) { int num,i,arr[],first,last,mid,item; Scanner sc = new Scanner(System.in); System.out.println("Enter the number of elements"); num = sc.nextInt(); arr = new int[num]; System.out.println("Enter the numbers"); for(i=0;i<num;i++) arr[i]=sc.nextInt(); System.out.println("Enter the element"); item = sc.nextInt(); first=0; last = num-1; mid=(first+last)/2; while(first<=last) { if(arr[mid]<item) first = mid+1; else if(arr[mid]==item) { System.out.println(item +" found at location"+ (mid+1)); break; } else { last = mid-1; } mid = (first+last)/2; } if(first>last) System.out.println(item + " item not found"); } }

ATM Machine Program Using Java

package com.java.basicprograms; import java.util.*; public class ATMMachine { public static void main(String[] args) { int balance = 20000, withdraw, deposite, num; Scanner sc = new Scanner(System.in); while (true) { System.out.println("Welcome to ATM Machine"); System.out.println("1.Withdraw"); System.out.println("2.Deposite"); System.out.println("3.Check Balance"); System.out.println("4.EXIT"); num = sc.nextInt(); switch (num) { case 1: System.out.println("Enter Amount to be Withdraw"); withdraw = sc.nextInt(); if (balance >= withdraw) { balance = balance - withdraw; System.out.println("Balance Amount is:   " + balance); System.out.println("Please collect money"); } else { System.out.println("You dont have enough money for withdraw"); } System.out.println(" "); break; cas...

Check Armostrong Numbers Using Java

package com.java.basicprograms; import java.util.*; public class ArmostrongNumber { public static void main(String[] args) { int num,temp,rem,sum=0; Scanner sc = new Scanner(System.in); System.out.println("Enter the number"); num = sc.nextInt(); temp = num; while(temp>0) { rem = temp%10; sum = sum +(rem*rem*rem); temp = temp/10; } if(sum==num) { System.out.println("The given number is Armostrong number"); } else { System.out.println("The given number is not an Armostrong number"); } } }

Alphabet check using Java

package com.java.basicprograms; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class AlphabetCheck { public static void main(String[] args) throws IOException { char ch; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enetr Alphabet"); ch = (char)br.read(); if(ch>=97 && ch<=123) { System.out.println("The given character is Lowercase"); } else if(ch>=65 && ch<=96) { System.out.println("The given character is Uppercase"); } else if(ch>=48 && ch<=57) { System.out.println("It is a Digit"); } } }

About Us Page Design Using HTML And CSS

<!DOCTYPE html> <head> <title>Java Basics</title> <style> body { margin: 0; } .topnav {   overflow: hidden;   background-color: LightGreen;   padding: 10px; } .topnav a { float: left; display: block; color: red; padding: 10px 10px; } .topnav a:hover { background-color: yellow; color: blue; } .footer { margin-top:25%; background-color: yellow; padding: 5px; text-align: center; } button { padding: 12px 12px; border-radius: 20px; width: 8%; border: 2px solid red; margin-left: 70%; background-image: radial-gradient(red, yellow, green); } h2 { text-align:  center; color: red; } </style> </head> <body> <div class="topnav"> <button onclick="window.location.href = 'login.html'">Login</button>      <a href="index.html">Home</a>    <a href="aboutus.html">About Us</a>    <a href="contactus.html...

Contact Us Form using HTML And CSS

<html> <head> <style type="text/css"> *{ box-sizing: border-box; } body{ margin: 0;  background-image: url("images/back.jpg"); } input[type=text],input[type=password] { padding: 10px 10px; border-radius: 20px; width: 80%; border: 2px solid LightGreen; margin-left: 5%; } textarea { padding: 15px 10px; border-radius: 20px; width: 80%; border: 2px solid LightGreen; margin-left: 5%; } button { padding: 15px 10px; border-radius: 20px; width: 40%; border: 2px solid LightGreen; margin-left: 25%; background-color: yellow; } .contact { padding: 15px 15px; border-radius: 100px; width: 30%; background-color:  #f7786b; box-shadow: 8px 8px 8px 8px LightGreen; margin-top: 2%; } h2 { text-align: center; color: blue; } .topnav {   overflow: hidden;   background-color: LightGreen;   padding: 10px; } .topnav a { float: left; display: block; color: red; padding: 10px 10px; } .topnav a:hover { background-...

Design Drop down Box using HTML

<!DOCTYPE html> <html> <head> <title>DropDown</title> </head> <body bgcolor="yellow"> <table align="center"> <tr> <td><label>Select State</label></td> <td> <select class="states" name= "states" style="padding: 10px 10px"> <option value="AP">AndhraPradesh</option> <option value="TS">Telangana</option> <option value="TN">TamilNadu</option> <option value="KT">Karanataka</option> <option value="MH">Maharashtra</option> </select> </td> </tr> </table> </body> </html>

Profile Card Design Using HTML And CSS

<!DOCTYPE html> <html> <head> <title>Profile Card</title> <style type="text/css"> .card { box-shadow: 4px 4px 4px 4px lightgreen; max-width: 300px; margin: auto;; font-family:arial; text-align: center; } .title { color: blue; font-size: 18px; } button { padding: 8px; color: yellow; background-color: red; text-align: center; width: 100%; font-size: 18px; } </style> </head> <body> <h2 style="text-align: center;">Profile Card</h2> <div class = "card"> <img src="F:/website/images/images.jpg" alt="mahesh" style="width: 300px;"> <h2>Mahesh Babu</h2> <h2 class = "title">Indian Film Actor<h2> <h2>Telugu Film Industries</h2> <button>Contact</button> </div> </body> </html>

Developing Scrolling in HTML

<!DOCTYPE html> <html> <head> <style> .div1 { width: 1000px;  height: 600px; overflow: scroll;    }     .div2 { width:1200px; height: 800px; background-color: lightgreen;      } </style> </head> <body> <div class="div1">       <div class="div2">         <h2>Java Basics</h2>       <h2>Java Basics</h2>         <h2>Java Basics</h2>       <h2>Java Basics</h2>       <h2>Java Basics</h2>       </div> </div> </body> </html>

Client Side Validation Using JavaScript

<html>  <head> <title>Form Validation</title>  <link rel="stylesheet" type="text/css" href="style.css"> <script>     function formValidate() {  var username = document.regform.name.value; var userpass = document.regform.pass.value; var useremail = document.regform.email.value; var zipcode = document.regform.zip.value; if( username == "" ) { alert( "Please Enter The Name" ); return false; } else if( userpass == "" ) { alert( "Please Enter The Password" ); return false; }         else if( useremail == "" ) { alert( "Please Enter The Email Address" );  return false; }     else if( zipcode == "" || isNaN( zipcode )) { alert( "Zip Code Allowes Only Numbers" ); return false; } } </script> </head> <body> <form name = "regform" onsubmit="return(formValidate());"> ...

Calculator Design Using HTML,CSS And JavaScript

<html> <head> <script>     function calculate(res){         calculator.dis.value = calculator.dis.value+res;           }        function clr(){         calculator.dis.value =  " ";           } </script> <style type="text/css"> body, html {     background: linear-gradient(to bottom, #33ccff 0%, #ff99cc 100%);     margin: 0;     padding: 0; } .container {     position: fixed;     top: 50%;     left: 50%;     transform: translate(-50%, -50%);     background: white;     box-shadow: 10px 10px 10px 10px lightgreen;     border-radius: 14px;     padding-bottom: 20px;     width: 280px;   } .display {     width: 100%;     height: 60px;     padding: 40p...