This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

stresssssssssssssssssss  RSS feed

 
John Carter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all, im new to this forum and to java, yeah i know you probably hat newbies by now. Anyway i am trying to get to grips with java and have stumbled accross a real biyatch of a problem. ive designed a multiple choice quiz which has a set of questions pre programmed, now, you can run the quiz and it will give you a mark at the end of it (there are only 4 simple questions at the mo.). All iwant to do is make it so that i can add questions and possible answers and save them to disk. So i can load up different quiz'. Sounds easy enough, however like i said im a newbie and im trying to get to grips with serialization. i was wandering if anyone did java for kicks and wanted to have a kick at mine or i'll kick my prescious ibook. Im sure it would take some of you 10 mins if that?

[EJFH: Invitation to take this offline deleted.]

i would greatly appreciatte any help.

P.S im not just trying to get the program working ideally i would like to understand it quite well......

Kind Regards,
John Carter
[ April 14, 2005: Message edited by: Ernest Friedman-Hill ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

Welcome to JavaRanch!

We're happy to help, but part of the bargain is that other people have to be helped, too. So instead of taking this offline, you have to let us work though things in public. Why not show us what you have so far, and tell us what's broken or where you're stuck, and I'm sure you'll get some good advice. Please use [ CODE][ /CODE] tags around any code you post to preserve formatting (remove the spaces.)
 
John Carter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i'll keep it online and hope for some help.

its a bit long but here goes (i hope im not breaking any forum laws with all this code) thanks in advance, p,s im quite new to the world of java.












thats all the classes. quiz card builder is what i cant seem to get to work. All i want to do is create new quiz' and save them using serialization...
 
John Carter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can no1 help with the QuizCardBuilder class?

please please pretty please
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is kind of a lot of code to look at.

The QuizCardBuilder.saveFile() method opens a file, writes two strings into it for each card, and closes the file. As far as it goes, it looks OK. You might want to use PrintWriter instead of BufferedWriter, and println() instead of write(), to put each String on its own line.

So what do you want to do next? I note you've asked about serialization, but you're not using that here, nor would it be an especially good idea to do so in this application.

Can you ask a more specific question?
 
John Carter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well the Quizcardbuilder class, isnt r eally my code, ive implemented it from a book and tried to get it to work for me. I know its a lot of code but im stuck in a rut and cant seem to get anywhere. The error comes from the array in QuizCardbuilder. If you try running it it doesnt work.

All i want to do is create a class that will allow me to to add questions to my quiz and then bring them back up. Basically add different quiz questions. If you could take a look at this i would be ever so gratefull to any1 who can help. I just cant seem to get it working at all.

please please please, im sure theres java freaks that would get their kicks out of solving this.... i hope. i wanna be one of those geeks.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you really want to learn, then cobbling something together patchwork that you don't understand isn't the way to do it. You need to take a step back and do a little reading and write a few simpler little programs first, so that you understand the relevant parts of the program.

Sun's online Java Tutorial is excellent. In the early parts (called 'trails') you'll get a tour of all the important APIs, including I/O stuff. If I were you, I'd plan on spending a dozen hours going through all of the " Trails Covering the Basics" parts, working the examples, making sure you understand them. By the time you get through, you'll be able to fix this program up by yourself straight away!
 
John Carter
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im in the process of learning it all, reading books, java.sun, and i do understand it as i go along but in terms of the problem im now trying to solve its a bit too much for me but would like to get it sorted.....Thanx
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!