0% found this document useful (0 votes)
60 views5 pages

Positve or Negitive Skewed

This document discusses a Java program that analyzes employee salary data from a database table to determine if a given salary value is positively or negatively skewed compared to the actual salary data distribution. The program connects to an Oracle database, retrieves minimum and maximum salary values, and compares an input salary to these values. It then prints whether the input salary is positively skewed, negatively skewed, or within the actual salary range.

Uploaded by

chirusagar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views5 pages

Positve or Negitive Skewed

This document discusses a Java program that analyzes employee salary data from a database table to determine if a given salary value is positively or negatively skewed compared to the actual salary data distribution. The program connects to an Oracle database, retrieves minimum and maximum salary values, and compares an input salary to these values. It then prints whether the input salary is positively skewed, negatively skewed, or within the actual salary range.

Uploaded by

chirusagar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

POSITIVELY OR NEGATIVELY SKEWED PROGRAM

import java.sql.*; import java.lang.Math.*; import java.io.*; public class Table { public static void main(String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:work", "system", "system"); Statement st = con.createStatement(); System.out.println("---TABLE----"); System.out.println("ID" + " " + "NAME" + " " + "SALARY" + " " + "COUNTRY"); ResultSet rs = st.executeQuery("Select * from employ"); while (rs.next()) { int id = rs.getInt(1); String name = rs.getString(2); int sal1 = rs.getInt(3); String country = rs.getString(4); System.out.println(id + " " + name + " " + sal1 + " " + country); } System.out.println("Enter any salary value"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int sal = Integer.parseInt(br.readLine()); rs = st.executeQuery("select min(salary),max(salary) from employ"); while (rs.next()) {

int min = rs.getInt(1); int max = rs.getInt(2); System.out.println("MIN VALUE:" + min); System.out.println("MAX VALUE:" + max); if (sal == min) { System.out.println("Given sal value is min value"); break; } else if (sal < min) { System.out.println("Given sal value is NEGATIVELY SKEWED"); break; } else if (sal == max) { System.out.println("Given sal value is max value"); break; } else if (sal > max) { System.out.println("Given sal value is POSITIVELY SKEWED"); break; } else if (sal > min && sal < max) { System.out.println("Given sal value is Neither POSITIVELY SKEWED nor NEGATIVELY SKEWED"); break; } } st.close(); con.close(); } catch (Exception ex) { System.err.print("Exception: "); System.err.println(ex.getMessage());} } }

EXECUTION Driver name: administrative tools-->data source odbc-->system dsn-->add-->Microsoft ODBC for oracle-->finish-->Data source name=work-->OK Table details create table employ create table employ(empid number,ename varchar2(20),salary number,country varchar2(20)); insert into employ values(100,'ABC',20000,'INDIA'); insert into employ values(200,'BCD',10000,'USA'); insert into employ values(300,'GEF',50000,'INDIA'); insert into employ values(400,'FGH',12000,'EUROPE'); commit;

OUTPUT C:\Program Files\Java>javac Table.java C:\Program Files\Java>java Table ---TABLE---ID NAME SALARY COUNTRY 100 ABC 20000 INDIA 200 BCD 10000 USA 300 GEF 50000 INDIA 400 FGH 12000 EUROPE Enter any salary value 100 MIN VALUE:10000 MAX VALUE:50000 Given sal value is NEGATIVELY SKEWED C:\Program Files\Java>javac Table.java C:\Program Files\Java>java Table ---TABLE---ID NAME SALARY COUNTRY 100 ABC 20000 INDIA 200 BCD 10000 USA 300 GEF 50000 INDIA 400 FGH 12000 EUROPE Enter any salary value 15000 MIN VALUE:10000 MAX VALUE:50000 Given sal value is Neither POSITIVELY SKEWED nor NEGATIVELY SKEWED

C:\Program Files\Java>javac Table.java C:\Program Files\Java>java Table ---TABLE---ID NAME SALARY COUNTRY 100 ABC 20000 INDIA 200 BCD 10000 USA 300 GEF 50000 INDIA 400 FGH 12000 EUROPE Enter any salary value 550000 MIN VALUE:10000 MAX VALUE:50000 Given sal value is POSITIVELY SKEWED

You might also like