Coding a Driver. Please HELP

// I need to code a driver for Employee class below.
// Need help getting started
// I fix prior errors, thank everyone
import java.text.NumberFormat;
import java.io.*;
public class Employee
private String firstName, midInitial, lastName;
private double salaryAmt;
public Employee()
getData();
public void getData()
String inStr;
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
System.out.print ("Enter first name");
firstName = in.readLine();
System.out.print ("Enter middle initial");
midInitial = in.readLine();
System.out.print ("Enter last name");
lastName = in.readLine();
System.out.print ("Enter salary amount");
salaryAmt = Double.parseDouble(in.readLine());
public int compareTo(Object emp2)
int result = 0;
if (salaryAmt < ((Employee)emp2).salaryAmt)
result = -1;
else if (salaryAmt == ((Employee)emp2).salaryAmt)
result = 0;
else
result = 1;
return result;
NumberFormat money = NumberFormat.getCurrencyInstance();
String result = "**************************************";
String firstNamelength = " ";
String lastNamelength = " ";
String salTemp = money.format(salaryAmt);
String salaryAmtlength = " ";
result += lastName + "," + lastNamelength.substring(0,lastNamelength.length()
- lastName.length()) + firstName + " " + firstNamelength.substring
(0,firstNamelength.length() - firstName.length()) + midInitial + "."
+ salaryAmtlength.substring(0,salaryAmtlength.length() -
salTemp.length()) + " " + money.format(salaryAmt) + "\n";
return result;
}

You mean you need to code a class 'Driver' that's a type of employee?
In that case you want to extend the employee class;
public class Driver extends Employee
public Driver() //constructor method
super.getData(); //calls the getData method in your Employee. Might not want to do this, this line's just here to show you how.
...etc, with additional methods/constructors to those in the Employee class.
Basically when you extend a class, your new class inherits all the methods and variables from your original class, but you can overload them by writing identically named methods in the subclass. So, say, Driver.compareTo() will call the same method as Employee.compareTo().
That should get you started. Since it looks like a homework I'm not gonna give you a fuller code example ;)

Similar Messages

  • I have macbook pro 13" I want to know how to copy files from my mac to the external Toshiba Hard Drive. I can't even delete files from my external hard drive. please help me my macbook HD is almost full and I have to copy my images to the Toshiba HD

    I have macbook pro 13" I want to know how to copy files from my mac to the external Toshiba Hard Drive. I can't even delete files from my external hard drive. please help me my macbook HD is almost full and I have to copy my images to the Toshiba HD

    To delete files from your external HDD, attach it to your MBP and drag the unwanted files to trash and then empty trash.
    Then you select the files that you want to transfer by 'drag and drop' to the external HDD and trash the files on your MBP.
    Ciao.

  • Protocol Confusion of freeTDS jdbc driver, please help!

    I use freeTDS jdbc driver to connect to MS SQL 2000. In my programme, firstly I need to select sth out, and base on this update the other field in the same table. TOC will like that
    Statement stmt1 = conn.createStatement();
    ResultSet rs1 = stmt1.executeQuery("select sth from table");
    stmt1.executeUpdate("update table set field1 = 'xxx'");
    exception throw: java.sql.SQLException: Protocol confusion. Got a 0x79 packet
    I checked from the source of TDS driver, this exception throws when the sql query output is not a resultset.
    These 2 querys are prefectly okay individually, I tried to reverse the order, doesn't work neither. Even I disconnect the DB Connection and reconnect it before running the 2nd query, it won't help.
    Please help!

    I haven't used freetds, but seems like defaul version is 5.0. Try it with 7.0 and see it works better. By the way, JDBC driver's readme says that it was only tested with MSSQL 6.5 and 7.0.
    ---- FAQ from freetds.org ----
    Do I need to configure anything?
    When you untar the package you will need to run:
    $ ./configure
    You also have the following options you can add to the configure statement:
    --with-tdsver=VERSION
    specify the TDS version to use
    (4.2, 4.6, 5.0, or 7.0) [default is 5.0].
    --enable-msdblib
    enable Microsoft APIs and behaviour for DBLib
    --enable-dbmfix
    rename dbopen() to tdsdbopen() as a work around for dbm name conflict
    --with-gnu-ld
    assume the C compiler uses GNU ld [default=no]
    --enable-shared
    build shared libraries [default=yes]
    --enable-static
    build static libraries [default=yes]
    IMPORTANT You must build with TDS version 4.2 to access a MSSQL server or Sybase prior to 10.0! TDS 7.0 may also be used to talk to MS SQL 7 and above.

  • HP dv4t not detecting hard drive, please help!

    Hello, its been just a little over a year since I've bought my HP dvt, and of course the problems start as soon as my warranty has ended.. It's been working fairly fine most of the year, and then just all of a sudden while not even doing anything of importance on computer last week I got a blue screen error..
    Ever since then I have had so much problems. At first it just started out with closing the screen and reopening it crashed the laptop in a couple minutes..
    The main problem now is, it just does not detect the hard drive when booting up! Sometimes (rarely) it does though.. I thought it was a windows problem, so I did fresh clean install of Windows 7 and reformatted the hard drive. Then I ran CHKDSK and it did it stuff and said volume clean at the end.. It worked perfectly for a couple of hours, was able to close screen and open with no problems. I downloaded "Hard drive sentinel" to monitor my hdd health, and it said 90% which is apparently excellent. Yet as I was installing adobe reader, it crashed, got the blue screen of death and has not been able to boot up since
    Can anyone tell what is the problem with it? Anyone else have similar problem? I've tried to reformat again with CD but it doesnt even recognize any drive to install on..
    Important thing to note is that, in the BIOS screen when i run the HARD DISK TEST, it does recognize it! So i dont understand why it doesn't load the operating system or cant see the hard drive anywhere else!!
    What is at fault even? Is the motherboard dead? Althought the bios screen loads fine so does that mean its OK? Is it the hard drive? CHKDSK and the hdd health monitor thing said it was ok right before the crashes..
    Please help, I have my first computer science lab in like 2 days with my laptop breaking just a couple days before it with barely any money left to buy a new laptop

    "computer always freezes at 56%"
    Time to replace your Hard Drive. BACK UP NOW!!!
    This will be the 3rd HD in a new HP HDX 18 for me (6 months old).
    Open up the HD bay and take a look at the model of the HD.
    If it is a SEAGATE MOMENTUS 7200.4  they are known to fail in as little as 1 month from install, and do not last more than 6 months.
    Google the brand and you will see that most people are reccomending that you remove the SEAGATE product ASAP (data recovery is next to impossible) and replace it with something else.
    I had just finished setting up the PC as I wanted it, OS, programs / Bios, software upgrades, then without warning the 2nd HD went.
    I lost EVERYTHING in my C drive, was just preparing to do a full BU and Mirror Image after deleting both from my D and External Drive.
    HP is replacing one piece of crap with another, I will be shopping for a different brand for the C drive after the laptop comes back from repair.
    There seems to be no end to this BS with SEAGATE drives.
    DO A FULL BU NOW!!!
    > Was your question answered? Mark it as an Accepted Solution!
    > See a great post? Click on the white star and give it a Kudos!

  • Blinking folder with question mark, and disk utility doesnt recognise hard drive, please help!!!

    So today i was using my macbook pro and for some reason my CD/DVD drive was causing noise when i put a DVD inside it, and for some reason it did not recognise my DVD. I force ejected it using the restart and clicking, but after that my computer showed a blinking folder and question mark during start up. I restarted my computer to Recovery HD, but instead it took me to internet Recovery HD (i have mountain lion), and so i went to disk utility to repair my disk, but in the left it did not recognise my hard drive. Please help! Im not that experienced in computing!

    Sounds like some sort of power issue and now your drive is not working.
    You'll have to take this to Apple for repair.
    You should read this if you don't have recent backups of your data off the machine.
    My computer is not working, is my personal data lost?

  • My laptop is pavilion dv6502au, laptop not getting lanport driver. please help me..

    hi
    Dear Sir,
    i have Hp pavilion DV6502au laptop.
    he not getting Lan driver,
    i am doing system formating, bios upgration, and use updated driver but issue not sloved. please help me out.
    thanks in advanced.
    i belive in HP service, Hope you help me about my issue.
    thanks,
    have a nice day......................... 

    We would need to know what operating system you installed but I am going to guess it is Windows 7.It would help more to know if it is 32 or 64 bit. Without that info I cannot link you to anything specific.
    This Forum has a Windows 7 upgrade guide specifically for your laptop:
    Upgrade Guide
    Your laptop has the AMD processor I believe and the network (LAN) driver is part of the main chipset (nVidia nForce) driver, which is absolutely critical to getting your laptop to work properly.

  • Win7 x64, Not recognizing GoFlex Home as DRIVE, PLEASE HELP!.

    Bought GoFlex Home 3TB, plugged into Cisco WRT310N V2, w/ Desktop PC (Win 7 64bit) does not recognize the drive. Get NETWORK ERROR "Windows cannot access \\goflex_home" Error Code: 0x80070035.  Can not map netork drive. Under Win Explorer the drive DOES appear as "GoFlex Home:UPNP-AV" in TWO places, 1) under Media Devices & 2) Under Storage. Bother places are treated as MEDIA because, when I click on either of them it opens Windows Media Player!  I can type in the IP address in BOTH IE & WIn Explorer and it will take me to the web page for the drive, where i can log in and create users, add folderes, etc.  I WANT TO USE THIS AS A BACK-UP DRIVE, but can't get WINDOWS TO RECOGNIZE IT.  I have turned off McAfee and still have same problem. PLEASE HELP!

    check this link: http://social.technet.microsoft.com/Forums/en-US/w7itprovirt/thread/e08c3500-a722-4b44-b644-64f94f63....
    Make sure that your ip assetings were correct. You can try to setup a static ip parameters on your computer then check if it will work.

  • Anyone using sata_promise w/ SATA drives, please help.

    A recently submitted a kernel patch to ensure that PATA ports are detected on Promise FastTrak controllers with both PATA and SATA ports. I have no way of testing SATA drives with this patch. Could someone using one of these controllers with SATA drives please patch a kernel and see if everything is still good?
    Bug Report #4770

    I'm using sata_promise with a SATA HD. Unfortunately, since Linux 2.6.17 it doesn't want to boot anymore (kernel oops on startup). For now I am using  2.6.15-archck which I still had lying around fortunately, though 2.6.16 also worked for me.
    Do you by any chance know about this problem? According to linux changes, this has happened to the promise driver:
    * Add support for the Promise Fasttrak TX4300/TX4310 4-port PCI SATA controllers based on the PDC40719 chip to sata_promise driver (commit)
    But that was actually a very minor patch, I guess some other promise/sata related change broke it.

  • Missing Files in Finder from External Hard Drive - PLEASE HELP

    Hi everyone, found myself with a bit of a problem and feeling a little stressed out.
    I have an external, Thunderbolt hard drive which seems to be working ok. Suddenly, after a reboot I am unable to see any files on the drive and the finder says 0 files. The disk size however remains the same, indicating the files are still somewhere on the drive. I am running 10.10.1 (14B25).
    Before the reboot I was writing to the drive using Compressor, I cancelled the export and then rebooted. Since then I have attempted the following with no luck:
    1. Rebooted the computer / PRAM and SMC reset.
    2. Tried accessing the drive on another computer and account. No luck.
    3. Verified the drive with Disk Utility
    4. Repaired system permissions
    5. The external TB drive is a raid, I have checked the raid with the software for error and no errors are present and the Raid looks in good shape. No red lights, flashing, warning sounds etc.
    6. I re-indexed spotlight.
    7. I made all hidden files visible, and couldn't see the files but i found the following hidden files in the attached picture.
    Could someone please give me some advice which could lead to the recovery of the data?
    Many, many thanks in advanced, I look forward to hearing form you.
    Best, Jim.

    A small update:
    I have tried using DiskWarrior - it sees the files and folders are there, confirms there is no physical disk problem but after a rebuild of the directory there are still no files present.
    Is there a preference file or hidden file I could try and remove?
    Any help would be greatly appreciated.
    Jim.

  • I can't copy files to External Hard Drive : Please help..

    Evening,
    I've just bought a Macbook and am just getting to grips with it. This is my first question on this forum...the first of many no doubt.
    Problem I've got is that I can copy file's from an external hard drive on to the MAC but I can't go back the other way and copy file's from the MAC on to the external hard drive - it says 'New Folder cannot be modified'.
    When I go into 'Ownership and Permission' of the external hard drive it says I can read only.
    The Hard Drive is a Octigen USB 2.0 drive if that helps..
    Any ideas?
    Thanks for your help
    R
    Macbook   Mac OS X (10.4.8)  
    Macbook   Mac OS X (10.4.8)  

    How confident are you that MacFuse/ntfs-3g is a reliable option for ordinary humans? It is at version 0.2.2, not long out of beta, the FAQ mentions slow write performance and other rough edges (possibly fixed in the current version), and this is a comment by the author as of 1/11/07:
    "Small disclaimer: Please note that MacFUSE is a complex piece of software, and it is a work in progress. We believe in releasing early and often, so we're releasing it now so that the community can help us to make it more robust."
    I have no need for it whatsoever, but if I did, I would have concerns about using it for a backup drive.

  • Problem with DVD drive, please help

    Hi people, please read the whole story and give me some advice.
    Last Friday, took the train from Stoke on trent to Birmingham to get to Apple at the bullring as the DVD drive is not recognising DVDs. Everytime I put a dvd in, the blank dvd message comes up! They told me they can replace the drive, but it will take a few days unless I pay for Apple pro care, as I needed it done quick, I paid, I roamed around the shops waiting for the phone call that it is ready. After an hour, got a call saying that the NEW DRIVE they have in stock is faulty, so I came back, they told me that they will call me when they get another one in stock. Went back home after having wasted a day in birmingham.
    Monday, got a message on my voicemail, the drive is in stock, pop in and we'll replace it. As I was working all week, I thought I'd give them a ring to arrange for the repair on Saturday where they can fit me. I tried to call all week, THE BULLRING STORE DOES NOT ANSWER THEIR PHONES!
    So, I popped in today, they said that they cannot do it today as they were busy. I asked to see the store manager and explained to her the situation and how annoying it is not to be able to get in touch with the store. She told me she'll get it done before closing time.Luckily by 2 pm it was ready, picked up , hopped back on the train to stoke. Got home tried a DVD, it works, then suddenly STOPS WORKING.
    The Macbook now doesn't recognise the drive at all, and I've got a DVD stuck in it.
    I have wasted another day in birmingham + train fares + Apple pro crae (79.99). I am very frustrated, I am now having second thoughts on the quality of apple products. If the matsui drives are crap, why don't they get another manufacturer to make it for them.
    I would appreciate your help on what should my next move be, I cannot keep loosing my time like this, I paid good money for this kit and I need it to work.

    http://www.which.co.uk/reportsand_campaigns/consumer_rights/reports/your_rights/buying_selling/Returning%20fau lty%20goods/Returning_faulty_goods_report_6576571.jsp
    Have a read of this article. You definantely should be able to get a full refund (whether they will do that is a different matter).
    If you don't ask (firmly) then you don't get. A 12 month warranty is there for a reason so use it. I can't believe they've actually charged you for work already within the 12 month period. I have also being trying ot look for an article about claiming unfair travel to and from a shop for repairs but I cannie find it.....
    Would you consider asking for a replacment laptop. From what I have read on the forums, if you call apple they will be more likely to help out, maybe give them a try and avoid Birmingham all together.
    ps, i'm from Stoke too -Small world eh?

  • CentOS & dropped FireWire drives -- please help.

    I installed Oracle Clusterware 10.2.0.3 (as well as RDBMS 10.2.0.3) on 64-bit CentOS 4.5 running on 2 AMD64 machines. Installation went fine and everything started/worked. But occasionally the FireWire drive is disappearing (fdisk –l giving nothing) and CRS crashing! The problem doesn’t seem to be CRS – it got to be the combination of OS (Linux kernel 2.6.9-55.EL) & Oracle FireWire module (built into kernel using source code) – or may be the Card or Ethernet cable! I didn’t see anything in the /var/log/messages -- totally lost & can’t do anything!
    Can you please tell what might be the reason & how to resolve it? Any help will be highly appreciated.
    Thanks.

    Hi, Thanks Very much for the reply.
    I got into this situation by applying a permission change to the whole of the Macbook folder, i dont really know what you would call it but the one containing all the system, library and other system files. Here is the result i got
    james-pipers-macbook:~ cablemaster$ ls -aldeO /etc/sudoers
    -rw-------+ 1 root wheel - 1135 24 Sep 2007 /etc/sudoers
    0: user:jamespiper allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity
    1: group:admin allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity

  • POWERMAC G5 NEW HARD DRIVE PLEASE HELP

    I just bought a powermac g5 singe 1.8GHZ with no hard drive off ebay for $99.99 to replace my old dead imac g3(psu went last night) i don't know what hd type it is ata or sata. will this hard drive off newegg.com work?  http://www.newegg.com/Product/Product.aspx?Item=N82E16822148432   i have a sata 320GB hd inside a newer pc can i use that one? i have the retail black os x 10.5 dvd that we got from apple 2 years ago for $129. thank you please get back to me and help me!

    japamac wrote:
    Actually, it will run without the fan assembly in place, which is a bad thing, IMHO.
    Semantics, eh?
    I should have said "NO, it shouldn't be run without the fans."
    (It's all fine, and I appreciate being kept honest.)
    I guess it's like not running a machine without a heat sink installed on the processor, some things which we consider not needing to be said must be said.....
    The good thing about running without a heat sink is that it is self-correcting, as it were, one way or another.  Actually, it would probably be noticed very quickly by the system in that the CPU die temp would rise to the danger point and the machine would crowbar down on its own, so long as the die resisted fracturing.
    That being said, I was somewhat surprised that the missing fan didn't trigger any particular response on my machine.  (I didn't check the system log when it happened, nor did I look at startup diagnostics on System Profiler (incuriosity on my part, I guess) because I just shut down and shoved the fan assembly back in.)   Having spent a goodly amount of my working life in an integration lab dealing with all the things that slipped through the cracks in the floor, I have a reflexive reaction to seeing one of those things pop up, like allowing the machine to go merrily long without a subsystem in place designed to protect the machine. 
    Reposing much confidence in your advice and assuming that others do as well, at least if they have spent the least little bit of time on these forums, I only added my comment to point out an unexpectedly missing element of protection in the Apple FW/SW world, i.e., the ability to boot without the fan and seem like things are A-OK.
    I'm going to go stir the liquid oxygen tank now.  What can go wrong with that?

  • Completely locked out of my 2 Firewire Drives Please Help

    Hi
    Both my drives have this infamous lock icon on them, as a result of me applying permissions to the contents of the various system related folders.
    I have tried running these
    sudo chflags nouchg /Volumes/"MOVIES STORAGE BACKUP"
    sudo chmod 775 /Volumes/"MOVIES STORAGE BACKUP"
    This is what i got:-
    sudo: /private/etc/sudoers is mode 0600, should be 0440
    I got the same result after doing both the commands.
    Any help would be greatly appreciated!

    Hi, Thanks Very much for the reply.
    I got into this situation by applying a permission change to the whole of the Macbook folder, i dont really know what you would call it but the one containing all the system, library and other system files. Here is the result i got
    james-pipers-macbook:~ cablemaster$ ls -aldeO /etc/sudoers
    -rw-------+ 1 root wheel - 1135 24 Sep 2007 /etc/sudoers
    0: user:jamespiper allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity
    1: group:admin allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity

  • Problem running Itunes from external hard drive- Please Help!

    So, last night I transferred my entire music folder over to an external hard drive. It copied all the files and I then proceeded to tell itunes where my new music folder was located. The problem I ran into was when I actually deleted the music files from my internal hard drive my library won't automatically find the files. When I click on a song it comes up with an error message saying, "original file cannot be found, would you like to locate file?". If I tell it yes, I can then manually tell it where the file is, and it will play. I'm really hoping there is an easier way around this issue because going in and doing this for every song in my library would take years. Should I clear out the library and then drag it from the external hard drive? Any help would be greatly appreciated. Thanks a lot.
    Sean

    I am experiencing a similar problem. I already had all my files on an external drive, where I had transfered them a few months back, and everything was working fine. I have now moved them, again, to a larger external drive, did everything the same, but now receive the message "original file cannot be found, would you like to locate file?" I was advised to use the "add to library" button under "FILE" in the menu bar and all the music was finally imported into iTunes, but the problem now is that the new data on the music files is missing all the metadata, and I am still stuck with all the original files with the "!" in front of each file that is going to have to be manually deleted one file at a time, all 30,000 of them. I would like a way to start over and get it right the first time. Anyone have any solutions? I have found a program, "Super Remove Dead Tracks" which should solve the problem of eliminating the "!" tracks, but so too all the metadata. Ideally I'd like to be able to locate the original files with all the attached metadata and get back to where I was 24 hours ago.

  • HT201250 My Time Machine Icon in the Toolbar is dimmed, and I'm unable to connect to my external Hard Drive, please help!

    Time Machine seems to be dead, since I'm unable to reset it. As soon as I try  anything, it goes to back to the "OFF" Position. Would appreciate any Help, to get my external Hard Drive to work. Adolffrom Peachland!
    Product, 2012 IMac 21.5"

    There's an apple store in my city but it is about a 20 minute drive and I do not have apple care. Do you think they would still help me?

Maybe you are looking for

  • How do I delete my iCloud account from my iphone 4s when I don't know the password to that account?

    someone has changed contact mail id appple? I forgot security question? help me please....

  • JSPX page Not Rendering on Tomcat

    Greetings to all. I used JDeveloper10132 to develop and test my application. After deploying the application on tomcat, all is working well except one page is not rendering when I open it. Thanks.

  • Download basket content could not  read

    Dear Consultant I have downloaded and installed the SAP download manager. I have configured the download manager and the screen shot for configuration is attached. During the runing of download manager. I am getting the below messages: "The basket co

  • Query problem in calculating some problems

    Hi gurus,         Can any one send me or tell me How do we calculat MAPE(Mean absolute percentage error) for DP query cube? 2,Calculating Ratio for APODp query cube 3.Estimate? I will be very thank full if anyone please let me know. Thanks a Lot Rega

  • How to extend java.io.File class?

    Hi, I have written the following code. import java.io.*; public class MyFile extends java.io.File { MyFile() } // end myFile class I am getting the following errors while compiling. Could any one throw some light on this and tell me what could be the