mercredi 25 février 2015

GPA Calculator with applet


Vote count:

0




Seen this posted before but I'm trying to iron out the last part of my code.


Essentially I have: Public Class GPACalc extends Applet {


public String firstname, lastname, course1, course2, course3, course4;


public int credit1, credit2, credit3, credit4, ct;


public float qp1, qp2, qp3, qp4, gp1, gp2, gp3, gp4, total, gpa;


public void paint (Graphics g)


{


String string_gpa = Float.toString(gpa);


g.drawString (string_gpa, 100, 150);


g.drawString (firstname, 200, 250);


}


Public static void main (String [] args)


{


***Here's where I need help. I want to reference the public variables firstname, lastname, credit1, gpa, etc. and have them assigned to information from the user. I've already done the System.out.printn("Please enter your name:")


I even got the applet to run with the following towards the end of my method.


GPACalc pj = new GPACalc();


Frame fr = new Frame ("GPA Calculator");


fr.add(pj);


fr.setSize(300,300);


fr.setVisible(true);


Graphics g = fr.getGraphics();


pj.paint(g);


I'm just trying to figure out what I'm missing as far as making sure my variables are set correctly and incorporate into the applet right.


-Thank you!



asked 37 secs ago







GPA Calculator with applet

Aucun commentaire:

Enregistrer un commentaire