Current location: Hot Scripts Forums » Programming Languages » Everything Java » Overloading,inheritance, Abstract Classes

Overloading,inheritance, Abstract Classes

 
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-30-09, 02:37 PM
NUbatherwich NUbatherwich is offline
New Member
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Overloading,inheritance, Abstract Classes

I am extremely new to Java, I am taking a class and below is our homework assignment for this week. I have emailed my teacher but have not received a response yet, so I am coming to you experts.

I need to build this program to write to a file using a java applet window that has Name, Address, GPA and Age, below is the information that the instructor provided, can someone help me learn this?

thanks.
Code:
// HERE'S YOUR TOOLKIT USE IT !!!!
/*        i = Integer.parseInt(str);
        if(i==-1) break;

        l = Long.parseLong(str);
        f = Float.valueOf(str).floatValue();
        d = Double.valueOf(str).doubleValue();
        b =Boolean.valueOf(str).booleanValue();
        // as you will see you do the booleans
        // like the floats and doubles !!!

       // c=  str[0];// nope this is C or C++
         c = str.charAt(0);// correct way to read a cahracter in Java
                       // zero is the first character of the string object.

       System.out.println(i+" "+l+" "+f+" "+d+ "   "+ c);
*/


import java.io.*;


class Emprec {
  String name;
  String address;  
 // double gpa;
 // int age;
  


Emprec (String name,String address)
{

try{
this.name=name;
this.address=address;


} catch(NumberFormatException errmsg)
{
  System.out.println("Invalid format"+ errmsg);
     
     this.name  = "";  
    // this.gpa = 0.0;
    // this.age = 0;
    

}//catch

}//Emprec constructor !!!!

String junk () {return("Happy Birthday !!!");}


public  String toString()
{

return
("\n your name is   "+ name+
"\n your address is "+ address+junk());


}//toString


// see if you can get the boolean to load from a text file.
// what's missing ????

//methods !!!!
// constructors !!!
}// Emprec

class ParseEmpSolHW
{
  
public static void main(String args[]) 
    throws IOException
 
 {

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


// create strings for the input data for the Emprec object

    String str_name;
    String str_address;   
   
    

   for(;;){

Last edited by UnrealEd; 05-23-09 at 05:15 AM. Reason: fixed code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two classes together ajit22 CSS 3 01-27-09 09:12 AM
PHP Classes Nebulous PHP 2 11-01-08 05:47 PM
Girl with no clue!!!!Booking Classes PHPMYSQL jobless1 Script Requests 0 07-13-07 04:56 AM
conceptual problem: abstract class, interface or class UnrealEd Everything Java 2 05-12-07 08:30 AM
Use Graphics classes in a class library RFickling Windows .NET Programming 0 01-15-05 03:07 PM


All times are GMT -5. The time now is 06:45 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.