jaymaan888's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
2 (0 per day)
Joined:
31-January 13
Profile Views:
89
Last Active:
User is offline Feb 11 2013 06:19 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   jaymaan888 has not set their status

Posts I've Made

  1. In Topic: New member - To creating a file and reading, adding new entries.

    Posted 1 Feb 2013

    Thank you Guys, I have made a new class and put all the codes there and in the main just openFile, readFile and closeFile. It much tidy now.

    However I have another issue to write to my file, below is my code and the descriptive errors which I am getting. Have a look if you know what it means.

    		if(selection == "Add a new car manually")
    		{
    			Cars A = new Cars();
    		
    			String c = JOptionPane.showInputDialog(null,"Please enter the Model of the car.");
    			String a = JOptionPane.showInputDialog(null,"Please enter the Cost of the car.");
    			String b = JOptionPane.showInputDialog(null,"Please enter the Make of the car.");
    		
    			double aa;
    			aa = Double.parseDouble(a);
    		
    			A.setCost(aa);
    			A.setMake(B)/>;
    			A.setModel(c);
    		
    			JOptionPane.showMessageDialog(null,"You have entered the following:-" + "\n"
    											+"Model: " + A.getModel() + "\n"
    											+ "Cost: " + A.getCost() + "\n"
    											+ "Make : " + A.getMake());
    			
    			FileWriter outputFile = new FileWriter("carsDB.csv");
    			BufferedWriter outputBuffer = new BufferedWriter(outputFile);
    			PrintWriter printstream = new PrintWriter(outputBuffer);
    			
    			printstream.println(aa + b + c);
    			printstream.close();
    		}
    
    


    ERRORS

    Exception in thread "main" java.util.NoSuchElementException
    at java.util.Scanner.throwFor(Scanner.java:838)
    at java.util.Scanner.next(Scanner.java:1347)
    at readfile.readFile(readfile.java:22)
    at Main.main(Main.java:58)

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

jaymaan888 hasn't added any friends yet.

Comments

jaymaan888 has no profile comments yet. Why not say hello?