import java.io.*;
public class inout{
public static void main (String[] args){
int a;
BufferedReader num= new BufferedReader(new InputStreamReader(System.in));
try
{System.out.println("Enter a number: ");
a = integer.parseInt(num.readLine());
System.out.println("THE NUMBER IS" + a);
}
catch(IOException e)
{System.out.println("ERROR");
{}}
import javax.swing.*;
public class jopt{
public static void main(String[]args){
int x;
x = Integer.parseInt(JOptionPane.showInputDialog("enter a number"));
JOptionPane.showMessageDialog(null, "the number is " + x, result", JOptionPane.INFORMATION_MESSAGE);
}}

Recommended Answers

All 10 Replies

Since you decided to just post the code and describe nothing about the problem, I will just point to the lines which *could* be holding the issues:-

Snippet1: Line 8

Snippet2: Line 6


Very helpful isn't it, so next time post a description of the problem you are facing.

what is your problem..

what exception or error you got..

post your run time or compile time error..

then we can help you..

otherwise we can't..we are not here to run and check your coding..

symbol : variable integer
location: class inout
a = integer.parseInt(num.readLine());
^
1 error

Process completed.

Snippet2: Process Complete.. thank you

change that line like below

Integer.parseInt(num.readLine());

instead of

integer.parseInt

D:\My Documents\ComSys\inout.java:9: ';' expected
System.out.println("THE NUMBER IS" + a);
^
D:\My Documents\ComSys\inout.java:13: '}' expected
}}
^
2 errors


java.lang.NoClassDefFoundError: inout
Exception in thread "main"
Process completed.

Need to see all the code around lines 9 and 13. There is a syntax error before them that is giving the compile problems.

You have ended the last line with {} what will you be opening the curly bracket for, change it to }}

thank you.. it fix now..

import java.io.*
public class ass2{
	public static void main (String args[]){
		BufferedReader myln = new BufferedReader (new InputStreamReader(System.ini));
		int grossPay,netPay,sss = 266,pagIbig = 200,philHealth = 300,hrsWorked,rate = 200,hrsLate;
		String myName = "", myStatus = "";
		try{
			System.out.print("Enter Employee Name: ");
			myName = myln.readLine();
			System.out.print("Enter Civil Status: ");
			myStatus = myln.readLine ();
			System.out.print("Enter Hours Worked: ");
			hrsWorked = Integer.parseInt(num.readLine());
			System.out.print("Enter Hours Late: ");
			hrsLate = Integer.parseInt(num.readLine());
			grossPay = (hrsWorked - hrsLate)*rate;
			netPay = grossPay - (sss + pagIbig + philHealth);
			System.out.println("Employee Name: " + myName);
			System.out.println("Civil Status: " + myStatus);
			System.out.println("Rate: " + rate);
			System.out.println("Hours Worked: " + hrsWorked);
			System.out.println("Hours Late: " + hrsLate);
			System.out.println("SSS premium: " + sss);
			System.out.println("Gross Pay: " + grossPay);
			System.out.println("Pag-Ibig: " + pagIbig);
			System.out.println("Phil Health: " + philHealth);
			System.out.println("Net Pay: " + netPay);
		}
		catch(IOException e){
			System.out.println("Error received");
		}
		}
	}

public class ass2{
^
1 error

Process completed.

-

java.lang.NoClassDefFoundError: ass2
Exception in thread "main"
Process completed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.