0

What wrong in this compiler say error Intger.ParseInt not found

import java.io.*; public class CompountInterest { public static void main(String[] args) { try{ DataInputStream x= new DataInputStream(System.in); int p,r,t,n; System.out.println("enter the principal amount:"); p=Intger.ParseInt(x.readLine()); System.out.println("enter the rate of interest:"); r=Intger.ParseInt(x.readLine()); System.out.println("enter the time period"); t=Intger.ParseInt(x.readLine()); System.out.println("enter the no of times that interest is compound perunit t"); n=Intger.ParseInt(x.readLine()); double amount=p*Math.pow(1+(r/n),n*t); double cinterest=amount-p; System.out.println("compound interest after"+t+"years:"+cinterest); System.out.println("amount after"+t+"years:"+amount); } catch(Exception e) {} } }

12th Dec 2021, 9:14 AM
Leena Patil
6 odpowiedzi
+ 3
Leena Patil There is 'Integer' not 'Intger' Also in Java method name starts from small letter so there would be 'parseInt() method name should be camelCase in Java
12th Dec 2021, 9:25 AM
A͢J
A͢J - avatar
+ 1
But both are use for same thing So why compile says problem
14th Dec 2021, 5:12 AM
Leena Patil
0
Thank I change that changes but compiler again say that Playground/CompoundIntrest.java uses or overrides a deprecated API And Recompile with -Xlint: deprecation for detail Then what do to solve it
12th Dec 2021, 9:37 AM
Leena Patil
0
Leena Patil Yes because of DataInputStream which is deprecated now so you can use Scanner class to take inputs. Scanner sc = new Scanner (System.in); int a = sc.nextInt();
12th Dec 2021, 12:29 PM
A͢J
A͢J - avatar
0
Ok
12th Dec 2021, 12:30 PM
Leena Patil
0
Leena Patil As I said deprecated means no longer use of DataInputStream That's why compiler is giving error.
14th Dec 2021, 6:32 AM
A͢J
A͢J - avatar