Uk student..Please help !!

Hi. I am 17 years old at college in the Hertfordshire region studying java programming. I am really stuck on this program and would be really greatful for some help on this. Below is my program and i am trying to create a survey in which the user clicks on the radio button, then when ok is pressed, the corresponding number is written to a seperate file and then the file is called and displayed to create a sccesful display of previous and present results. PLEASE HELP!!!
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.JApplet;
import javax.swing.JTextArea;
import java.io.*;
<applet code="Survey22" width = 1025 height = 660>
</Applet>
public class Survey22 extends JApplet implements ActionListener {
     JLabel surveypic;
     ImageIcon icon, name, surveyimage;
     JMenuBar menubar;
     JMenu menu;
     JMenuItem menuitem;     
     JRadioButton rb1, rb2, rb3, rb4;
     ButtonGroup group = new ButtonGroup();     
     JTextField field;
     JButton ok;
     JButton clear;
     JMenuBar menubar2;
     JMenu menu2;
     JMenuItem menuitem2;
     JLabel FinalFant, Quak, Crash, Hal, res;
     ImageIcon results = new ImageIcon("RESULTS.JPG");
     public void init(){
//***************************************************** MENUBAR **********************************************************
     menubar = new JMenuBar();
     menu = new JMenu("Menu");
     ImageIcon results = new ImageIcon("RESULTS.JPG");
     menuitem = new JMenuItem("",results);
     menuitem.addActionListener(this);
     menuitem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
     menu.add(menuitem);
     menubar.add(menu);
//****************************************************** MENUBAR *********************************************************
//****************************************************** OPTIONS *********************************************************
     name = new ImageIcon("FINALFANTASY7.JPG");
     rb1 = new JRadioButton(" Final Fantasy",name);
     rb1.addActionListener(this);
     getContentPane().setLayout(null);
     getContentPane().add(rb1);
     rb1.setBounds(10,210,270,140);
     name = new ImageIcon("QUAKE.JPG");
     rb2 = new JRadioButton(" Quake", name);
     rb2.addActionListener(this);
     getContentPane().setLayout(null);
     getContentPane().add(rb2);
     rb2.setBounds(310,210,270,140);
     name = new ImageIcon("CRASHBANDICOOT.JPG");
     rb3 = new JRadioButton(" Crash Bandicoot", name);
     rb3.addActionListener(this);
     getContentPane().setLayout(null);
     getContentPane().add(rb3);
     rb3.setBounds(610,210,300,140);
     name = new ImageIcon("HALO.JPG");
     rb4 = new JRadioButton(" Halo", name);
     rb4.addActionListener(this);
     getContentPane().setLayout(null);
     getContentPane().add(rb4);
     rb4.setBounds(10,365,350,160);
//****************************************************** OPTIONS *********************************************************
//****************************************************** EXTRAS **********************************************************
     surveyimage = new ImageIcon("WELCOME.JPG");
     surveypic = new JLabel(surveyimage);
     getContentPane().add(surveypic);
     surveypic.setBounds(10,40,465,150);
     field = new JTextField();
     field.setEditable(false);
     getContentPane().setLayout( null );
     getContentPane().add(field);
     field.setBounds(600,40,100,30);
     ok = new JButton("Ok");
     ok.addActionListener(this);
     getContentPane().add(ok);
     ok.setBounds(575,100,73,30);
     clear = new JButton("Cancel");
     clear.addActionListener(this);
     getContentPane().add(clear);
     clear.setBounds(655,100,73,30);
     getContentPane().setLayout(new BorderLayout());
     getContentPane().add(menubar, BorderLayout.NORTH);
//******************************************************* Action ************************************************************
     public void actionPerformed(ActionEvent e){
     if(e.getActionCommand() == " Final Fantasy") field.setText(" Final Fantasy");
     else if(e.getActionCommand() == " Quake") field.setText(" Quake");
     else if(e.getActionCommand() == " Crash Bandicoot") field.setText(" Crash bandicoot");
     else if(e.getActionCommand() == " Halo") field.setText(" Halo");     
     else if(e.getActionCommand() == "Cancel") field.setText("");
     else if(e.getActionCommand() == "Ok" || e.getActionCommand() == "") {
     try{
     FileWriter fw = new FileWriter("Survey2Results.txt", true);
     char result = 0;
     if(field.getText().equals(" Final Fantasy")) result = 1;
     else if(field.getText().equals(" Quake")) result = 2;
     else if(field.getText().equals(" Crash bandicoot")) result = 3;
     else if(field.getText().equals(" Halo")) result = 4;
     else if(field.getText().equals(null)) result = 0;
     BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
     fw.write(result);
     fw.close();
     getContentPane().remove(field);     
     getContentPane().remove(ok);
     getContentPane().remove(clear);
     getContentPane().remove(surveypic);
     getContentPane().remove(rb1);
     getContentPane().remove(rb2);
     getContentPane().remove(rb3);
     getContentPane().remove(rb4);
     getContentPane().remove(menubar);
     String out;
     FileReader fr = new FileReader("Survey2Results.txt");
     BufferedReader br = new BufferedReader(fr);
     out = br.readLine();
     int ff=0, q=0, h=0, cb =0;
     for(int i = 0; i < out.length(); i++){
     int nums[] = { out.charAt(i)};
     if(out.charAt(i) == '1') ff++;
     else if(out.charAt(i) == '2') q++;          
     else if(out.charAt(i) == '3') cb++;
     else if(out.charAt(i) == '4') h++;
     res = new JLabel(results);
     FinalFant = new JLabel("Final Fantasy, currently has : " + ff + " Votes.");
     Quak = new JLabel("Quake, currently has : " + q + " votes.");
     Crash = new JLabel("Crash Bandicoot, currently has : " + cb + " votes.");
     Hal = new JLabel("Halo, currently has : " + h + " votes.");
     fr.close();
     getContentPane().setLayout(null);
     getContentPane().add(res);
     getContentPane().add(FinalFant);
     getContentPane().add(Quak);
     getContentPane().add(Crash);
     getContentPane().add(Hal);
     res.setBounds(390,50,200,100);
     FinalFant.setBounds(30,200,300,50);
     Quak.setBounds(400,200,200,50);
     Crash.setBounds(30,400,200,50);
     Hal.setBounds(400,400,200,50);
     repaint();
     }catch(IOException exc){}
Thanks Matt.

Do you have a specific problem or question, or would you just like us to do your homework for you?
If you have a specific question about how to use a certain class or what's creating an exception in your code, we're all more than happy to help out. Otherwise, if you neeed help in designing your project, you should probably see your prof. a TA, or a friend
Hi. I am 17 years old at college in the Hertfordshire
region studying java programming. I am really stuck
on this program and would be really greatful for some
help on this. Below is my program and i am trying to
create a survey in which the user clicks on the radio
button, then when ok is pressed, the corresponding
number is written to a seperate file and then the
file is called and displayed to create a sccesful
display of previous and present results. PLEASE
HELP!!!

Similar Messages

  • POPC UPS FROM EVERY SIDE OF MY MONITOR ALL THE TIME..PLEASE HELP..IM AN ONLINE STUDENT

    Hello
    Wen I first purchased this computer it ran perfectly with no issues at all. All of a sudden all these flipping pop-ups started coming up from every angle of my monitor. They will be from HP, consumers, you name it! Then I'll have messages about java, trojans, drivers.......I'm so confused!!!!
    Please help me!!! My son and I are online students and these always get in the way and slow the system down.
    I thank you in advance.
    #INDESPERATENEED

    CBCMOM, welcome to the forum.
    It sounds like you have a virus or some other type of malware.  I suggest running your antivirus program to see if it finds anything.
    Please click the "Thumbs up + button" if I have helped you and click "Accept as Solution" if your problem is solved.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • Please help with an sql to show more than one records into single row for each student

    From the following data I would like to create an sql to get the information  as the following layout
    studentid,  firstTerm,  EnglishMark1,ScienceMark1,MathsMark1, Secondterm,EnglishMark2,ScienceMark2,MathsMark2,
    ThirdTerm,EnglishMark3,ScienceMark3,MathsMark3 // As single rows for each student
    Example
    1 First, 30,40,20,Sec,30,40,20,  simillarly next row for next row for another sudent. Please help to generate the sql for the same.
    Please help it would be very appreciate.
    With Thanks
    Pol
    polachan

    create table yourdata (studentid int, term varchar(10), section varchar(50), Mark int)
    insert into yourdata values
    (1,'First','Math',20),(1,'First','English',30),(1,'First','Science',40),
    (2,'First','Math',20),(2,'First','English',30),(2,'First','Science',40),
    (3,'First','Math',20),(3,'First','English',30),(3,'First','Science',40),
    (1,'Sec','Math',20),(1,'Sec','English',30),(1,'Sec','Science',40),
    (2,'Sec','Math',20),(2,'Sec','English',30),(2,'Sec','Science',40),
    (3,'Sec','Math',20),(3,'Sec','English',30),(3,'Sec','Science',40)
    Select studentid
    ,max(case when term='First' and section='English' Then Mark End) as EnglishMark1
    ,max(case when term='First' and section='Science' Then Mark End) as ScienceMark1
    ,max(case when term='First' and section='Math' Then Mark End) as MathMark1
    ,max(case when term='Sec' and section='English' Then Mark End) as EnglishMark2
    ,max(case when term='Sec' and section='Science' Then Mark End) as ScienceMark2
    ,max(case when term='Sec' and section='Math' Then Mark End) as MathMark2
    ,max(case when term='Third' and section='English' Then Mark End) as EnglishMark3
    ,max(case when term='Third' and section='Science' Then Mark End) as ScienceMark3
    ,max(case when term='Third' and section='Math' Then Mark End) as MathMark3
    From yourdata
    Group by studentid
    drop table yourdata

  • I payed for my creative cloud membership 9.99 / monthe. bought it this morning. I was able to download Lr, but not Ps. I am wondering why is asking me to pay antoher 9.99 if I got the student deal. Can you please help. thank you.

    I payed for my creative cloud membership at 9.99/mo. I got it this morning. I was able to download Lr, but not able to download Ps. is asking me to pay again. Why is that, because I got the student packet deal. Can you please help.

    Mariacazarez what is the exact error message you receive when you try to download and install Photoshop?  For information on how to install the Adobe Creative applications included with your membership please see Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.

  • HT201210 i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    What version of ios do you have?
    See Texas Mac Man's write up here.
    My iPad won't connect to my home wifi - even though it has previously worked fine.  It says it is unable to connect? - any ideas

  • Hi I'm having trouble downloading Adobe Creative Suite 6 teacher student addition on my mac i have downloaded it and i received a redemption coad and a serial number but when i entered the serial number it says its invalid... Please help!

    Hi I'm having trouble downloading Adobe Creative Suite 6 teacher student addition on my mac i have downloaded it and i received a redemption coad and a serial number but when i entered the serial number it says its invalid... Please help!

    i know extremely frustrating that there is no one to contact!
    i got my friend to help not sure if your having the same problem but i had to download stuffit expander from the app store to expand the zip files that you initially download you should be able to open them and enter serial number from there
    don't know if that helps theres no where that tells you how to do that so its extremely frustrating..
    hope that can be of some help.

  • I am still waiting for my student approval to set up the Adobe creative suite. Can you please help?

    I am still waiting for my student approval to set up the Adobe creative suite. Can you please help?
    Jasper

    Why are you asking this in the Adobe Reader forum?
    Best contact Adobe Customer Support.

  • To purchase lightroom 5 for student and teacher edition, upon check out "Error in Your Order. Account registered for a different country. Please help. Thanks.

    to purchase lightroom 5 for student and teacher edition, upon check out "Error in Your Order. Account registered for a different country." Please help, thanks.

    Hi boags2014,
    Please refer this link and know the work-arounds for the same:
    How do I complete a purchase when I get an incorrect "country" error?
    Regards,
    Anubha

  • Hi, I did the 30-day trial of indesign, now I bought the student package and when installing it they ask me for my serial number and I didn't get any.. please help!!!

    Hi, I did the 30-day trial of indesign, now I bought the student package and when installing it they ask me for my serial number and I didn't get any.. please help!!!

    We have received your payment - thank you! For your information are the details of the order here:
    Ordering information:
    Creative Cloud membership Photo Student and Teacher Edition (one-year)
    74.00 DKK per. month
    Order number[Removed by moderator]
    18.50 DKK charges
    Total payment today:  
    92.50 DKK

  • Help for a Student Please?

    When entering 'ed', i get this response: Wrote file afiedt.buf
    45
    I don'tknow how to get out of the? and back to the SQL> promtpt>
    Would somebody please help this new student? Thx!
    null

    Looks like your '_editor' parameter is not set for SQLPLUS. By default, SQLPLUS uses 'ed' for editing. Set the parameter '_editor' to 'vi'.
    To get out of '?' type in 'q' and press enter to get back to the sql prompt.
    null

  • I am a Academy of Art University student. I purchased my CC on 04/18/2014. Since I don't graduate yet, I really don't know why can't I keep using my CC, or redeem it again!!!! Please help!!!!

    I am a Academy of Art University student. I purchased my CC on 04/18/2014. Since I don't graduate yet, I really don't know why can't I keep using my CC, or redeem it again!!!! Please help!!!!

    Contact Adobe Support directly... preferably before the 18th.
    Phone support | Orders, returns exchanges
    http://helpx.adobe.com/x-productkb/global/phone-support-orders.html
    Chat support - For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    Creative Cloud support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html ( http://adobe.ly/19llvMN )

  • I have a Student CC complete membership.  I am still shown as a 'free' account and that I have trial versions of apps.  Please help!

    I have a Student CC complete membership.  I am still shown as a 'free' account and that I have trial versions of apps.  Please help!

    sign in to your cc desktop app using the same adobe id used to subscribe to cc, Sign out, Sign in | Creative Cloud Desktop app
    if that fails, check your connection, Sign in, activation, or connection errors | CS5.5 and later

  • I am currently a full time college student and last term I had access to the creative cloud products, when I attempt to access InDesign I am asked to purchase products.  Please help.

    I am currently a full time college student and last term I had access to the creative cloud products, when I attempt to access InDesign I am asked to purchase products.  Please help.

    Do you have a subscription that you purchased and still pay into?  If so, contact Adobe support thru chat and see if they can assist you with your subscription.
    Chat support - For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    Creative Cloud support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html ( http://adobe.ly/19llvMN )
    Did the school provide your access for free?  If so, check with the school to see if they still provide free access to the software for students.
    If neither of the above situations match yours, please provide more detail regarding what gave you access to the software.

  • I had already paid the teacher, student edition. And it's for a year. But now since my 30 days free tril was over, I couldn't open it anymore.  can someone please help me?

    I had already paid the teacher, student edition. And it's for a year. But now since my 30 days free tril was over, I couldn't open it anymore.  can someone please help me?

    Felipef32638067 please see Sign in, activation, or connection errors | CS5.5 and later for information on how to resolve the connection error preventing your membership from authorizing.

  • I have bought a CS5 suite (student) 2 years back. I have lost the original box and DVD. Now I am migrating to another computer and I couldnt find a source to install the CS5. Please help.

    I have bought a CS5 suite (student) 2 years back. I have lost the original box and DVD. Now I am migrating to another computer and I couldnt find a source to install the CS5. Please help.
    I couldnt even contact adobe direct to address the issue.

    If you registered with Adobe, your authorization number will be in your account on Adobe's website. Then you can use their downloads page and download CS5 and install it. A search on their main page will get you to the download page.

  • I keep on losing my tabs and i am getting seriously frustrating as i need them to open each and every time i open firefox 4, i have tabs mix plus. why does this keep on happening? please help as i am a student and i need help with this..

    i have now installed too many tabs 1.3.3 to see if that will fix problem.
    but yes each and every time i use firefox, not googlechrome, or ie or opera but only firefox 4 and having used tabs mix plus before i never had a problem.
    but now with firefox beta and now the full release, the issue is still arising. evrytime i open firefox i close my eyes and wait for it to load... and load... when it does open, i open my eyes and lo and behold my tabs are gone.
    thats it please help guys, i love firefox for many reasons i dont want to use opera.
    regards
    ehtisham

    '''[https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/ Adblock Plus]''' {web link}
    Blocks annoying video ads on YouTube, Facebook ads, banners
    and much more. Adblock Plus blocks all annoying ads, and
    supports websites by not blocking unobtrusive ads by default (configurable).
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/viruses/disinfection/5350 Anti-Rootkit Utility - TDSSKiller]
    * [http://general-changelog-team.fr/en/downloads/viewdownload/20-outils-de-xplode/2-adwcleaner AdwCleaner] (for more info, see this [http://www.bleepingcomputer.com/download/adwcleaner/ alternate AdwCleaner download page])
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

Maybe you are looking for

  • My trackpad wont register when i click down on both sides. I have a MBP from 2009.

    Just yesterday my mouse was going crazy moving all over the place and clicking everything and so i restarted it. Then when i turned my MBP back on it worked fine for a few minutes and then went crazy after a while. I left it alone the whole night and

  • Adding commands to a canvas

    when the canvas is set to full screen and commands are added to it, the menu will appear if you press either the left or right button near the screen.. is it possible to make it appear only when the left button is pressed and not the right?

  • Deleting templates

    Can you delete a custom template in Pages?

  • Will ios6 be available as a free update on the current new iPad

    Will iOS 6 be available as a free download update on the current 3gen iPad or will it be something that have to be purchased????

  • Cannot Publish Site anymore!!

    I am trying to update my page and now it is just stuck. I cannot save or Publish. It just gives me a loud" Bleep" sound. I though there was some text box open to tell me something but nothing. Now I am going to have to force quit and loose all of my