Wednesday, 9 October 2013

JAVA PROGRAMS

a)      Write a Java program that prints all real solutions to the quadratic equation ax2 + bx +c = 0. Read in a, b, c and use the quadratic formula. If the discriminant b2- 4ac is negative, display a message stating that there are no real solutions.

Program:

import java.io.*;
class SolvingEquation
{
        int desc;
       double r1,r2;
       void solution(int a,int b,int c)
       {
           desc=(b*b)-(4*a*c);
           if(desc>0)
           {
                  r1=(-b+Math.sqrt(desc))/(2*a);
                  r2=(-b-Math.sqrt(desc))/(2*a);
                  System.out.print("\nThe Roots Are: "+r1+"\t"+r2);
           }
           else if(desc==0)           System.out.print("\nThe Roots Are Equal:"+(-b/(2*a)));
           else                               System.out.print("\nThere Are No Real Solutions");               
       }
       public static void main(String args[]) throws IOException
       {
           int a,b,c;
           SolvingEquation obj=new SolvingEquation();
           BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
           System.out.print("\nEnter value of a:");
           a=Integer.parseInt(br.readLine());
           System.out.print("\nEnter value of b:");
           b=Integer.parseInt(br.readLine());
           System.out.print("\nEnter value of c:");
           c=Integer.parseInt(br.readLine());
           obj.solution(a,b,c);
        }
}      



Output:
E:\Lab>javac SolvingEquation.java
E:\Lab>javac SolvingEquation.java
Enter value of a:2
Enter value of b:3
Enter value of c:1

The Roots Are: -0.5     -1.0

Tuesday, 8 October 2013

Soon, apply for passport from your phone.......!!!!!!!

CHENNAI: Soon there will be a smart way to apply for passports. The agency of external affairs is in the final stages of introduction an app that will allow people to concern and pay the charge for passports on their mobile phones.

The new app will be an upgrade edition of mPassport Seva that is available for 
Android, iOSand Windows Phone platform. mPassport Seva currently allows users to find general in sequence, locate nearest passport centre and police station, calculate fees and track the status of applications. More features like provision to file application and pay fees will be added toit.

"The capability to help applicants fill passports and make compensation through the app should be available in one to one-and-a-half months," said Golok Kumar Simli, principal consultant and head (technology), ministry of external affairs. Applicants will be able to log in, file the application and track its status but will have to carry hard copies of the documents required to the passport seva kendra after an ARN number is generated and an appointment fixed, he said. Citing security concerns, he, however, refused to explain how the app will work.

Monday, 7 October 2013

Java program to open Notepad

How to open Notepad through java program: Notepad is a text editor which comes with Windows operating system, It is used for creating and editing text files. You may be developing java programs in it but you can also open it using your java code.

import java.util.*;
import java.io.*;
 
class Notepad {
  public static void main(String[] args) {
    Runtime rs = Runtime.getRuntime();
 
    try {
      rs.exec("notepad");
    }
    catch (IOException e) {
      System.out.println(e);
    }   
  }
}

C program to shutdown or turn off computer

C Program to shutdown your computer: This program turn off i.e shutdown your computer system. Firstly it will asks you to shutdown your computer if you press 'y' the your computer will shutdown in 30 seconds, system function of "stdlib.h" is used to run an executable file shutdown.exe which is present in C:\WINDOWS\system32 in Windows XP. You can use various options while executing shutdown.exe for example -s option shutdown the computer after 30 seconds, if you wish to shutdown immediately then you can write "shutdown -s -t 0" as an argument to system function. If you wish to restart your computer then you can write "shutdown -r".
 
#include <stdio.h>
#include <stdlib.h>
 
main()
{
   char ch;
 
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);
 
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");
 
   return 0;
}

Sunday, 6 October 2013

Adobe hacked, 2.9 million accounts compromised

Adobe Systems, which makes software such as Photoshop, person who reads and Creative darken, on Friday said its safety team has discovered “sophisticated attacks” on its net, exposing financial information of its 2.9 million consumers.
“Adobe's security team discovered distrustful activity during regular security monitoring. Our research to date indicates that the cyber attacker removed certain customer information between September 11 and September 17, 2013,” an Adobe spokesperson said in an emailed response to The Hindu.
The US-based company said investigations point to that the attackers accessed Adobe customer IDs and encrypted passwords on their systems.

“We also believe the attacker removed from our systems certain information relating to 2.9 million Adobe customers. This includes customer names, encrypted credit or debit card numbers, expiration dates and other information relating to customer orders," the spokesperson added.

FREE HIT COUNTERS