Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

parseDouble(java.lang.String) in java.lang.Double cannot be applied to (int

843810Dec 20 2003 — edited Dec 21 2003
Hi,
I have this problem with my program. It prompt that "parseDouble(java.lang.String) in java.lang.Double cannot be applied to (int). How do I solve it? Pls help.

import java.io.*;
import java.text.*;

class StudentMarks
{
public static void main(String[] args) throws IOException
{
int stuNo, stuNumCos;
String familyName, firstName, degCourse;
double [] courseMarks, examResults; //declare an array of double

courseMarks = new double [7]; //create an array of double
examResults = new double [7];

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Please enter Student Number (Student Number must be between 10000 to 99999): ");
stuNo = Integer.parseInt(in.readLine());

System.out.print("Please enter Family Name: ");
familyName = in.readLine();

System.out.print("Pls enter First Name: ");
firstName = in.readLine();

System.out.print("Please enter Degree Course title: ");
degCourse = in.readLine();

System.out.print("Please enter the number of courses to be calculated.(Number of course must be a whole number between 1-8): ");
stuNumCos = Integer.parseInt(in.readLine());

//Section A: Prompt and stored coursework marks and exam results from student
int stuCnt=1;
int i=0;

do{
System.out.print("Coursework mark for course " + stuCnt + " :");
courseMarks [ i ]=Double.parseDouble(in.read());

System.out.print("Exam Results for course " + stuCnt + " :");
examResults [ i ]=Double.parseDouble(in.read());

stuCnt++;
i++;
} while(stuCnt != (stuNumCos+1));
}
}
*********************************************************************
Thks! Jo
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2004
Added on Dec 20 2003
3 comments
462 views