ToString method and getData() are causing errors

import java.text.NumberFormat;
import java.io.*;
public class Employee
private String firstName, midInitial, lastName;
private double salaryAmt;
public Employee()
getData();
private 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;
public String toString()
String result;
String firstNamelength = " ";
String lastNamelength = " ";
salaryAmtlength = " ";
NumberFormat fmt = NumberFormat.getCurrencyInstance();
result += lastName + "," + lastNamelength.substring(0,lastNamelength.length()
- lastName.length()) + firstName + firstNamelength.substring
(0,firstNamelength.length() - firstName.length()) + midInitial + "." +
fmt.format(salaryAmtlength.substring(0,salaryAmtlength.length -
salaryAmt.length()));
return result;

See posting history. Nary a word of reply or acknowledgement to a total of more than 20 responses on 5 earlier threads.
db

Similar Messages

  • I use Safari on a Windows XP os.  Suddenly I cannot access my email and there are no error messages to indicate why.  How do I troubleshoot this?

    I have been using safari on a pretty old Dell with Windows XP.  I use it mainly to access email on google.  Suddenly I cannot get into my emails and there
    are no error messages.  How should I troubleshoot this problem?  Also, safari is an older version - should I upgrade it?

    Safari for Windows was discontinued a long time ago. It has bugs that will never be fixed, and it should no longer be used.

  • What are abstract classes/methods and what are they for?

    Hi,
    I've just heard about abstract classes and methods and I'm just wondering what exactly they're used for, and why are they there for the Graphics class for example?
    Cheers.

    raggy wrote:
    bastones_ wrote:
    Hi,
    I've just heard about abstract classes and methods and I'm just wondering what exactly they're used for, and why are they there for the Graphics class for example?
    Cheers.Hey bro, I'll try to solve your problemYou have to know two important concepts for this part. 1 is Abstract classes and the other is Interface classes. Depends on the nature of the project, you need to set certain level of standards and rules that the other developers must follow. This is where Abstract classes and Interface classes come into picture.
    Abstract classes are usually used on small time projects, where it can have code implementation like general classes and also declare Abstract methods (empty methods that require implementation from the sub-classes).Wrong, they are used equally among big and small projects alike.
    Here are the rules of an Abstract class and method:
    1. Abstract classes cannot be instantiatedRight.
    2. Abstract class can extend an abstract class and implement several interface classesRight, but the same is true for non-abstract classes, so nothing special here.
    3. Abstract class cannot extend a general class or an interfaceWrong. Abstract classes can extend non-abstract ones. Best example: Object is non-abstract. How would you write an abstract class that doesn't extend Object (directly or indirectly)?
    4. If a class contains Abstract method, the class has to be declared Abstract classRight.
    5. An Abstract class may or may not contain an Abstract methodRight, and an important point to realize. A class need not have abstract methods to be an abstract class, although usually it will.
    6. Abstract method should not have any code implementations, the sub-classes must override it (sub-class must give the code implementations). An abstract method must not have any implementation code code. It's more than a suggestion.
    7. If a sub-class of an Abstract class does not override the Abstract methods of its super-class, than the sub-class should be declared Abstract also.This follows from point 4.
    9. Abstract classes can only be declared with public and default access modifiers.That's the same for abstract and non-abstract classes.

  • All of the webpages are showing up "strange" not all the colors are showing, not all the correct boxes are showing, and there are numerous errors in the error console (which doesn't help me)! Is there just a way to reset everything to go back to normal??

    Some of the error codes are:
    filter
    background
    border radius
    box shadow
    height

    See:
    * http://kb.mozillazine.org/Website_colors_are_wrong
    * http://kb.mozillazine.org/Websites_look_wrong
    Other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    # Shockwave Flash 10.0 r45
    # Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • IIF with InStr and LEFT -1 Causes #Error in SSRS 2008R2

    Hello,
    I'm using IIF with InStr to test for a "/" in a field on a report.  The left function works fine unless I try to subtract 1 from it.  This code works fine:
    =IIF(InStr(Fields!WellCompName.Value,"/")=0, Fields!WellCompName.Value, left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")))
    But this code causes the True condition to yield #Error in the report when I add the -1 to the end of the left function:
    =IIF(InStr(Fields!WellCompName.Value,"/")=0, Fields!WellCompName.Value, left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")-1))
    I do need -1 to remove the "/" but it doesn't work with IFF and LEFT.
    Thanks

    Hi SomeDBGuyOutThere,
    I have tested on my local environment and can reproduce the issue, your issue caused by when the value in the field WellCompName don't contains "/". the function "left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")-1)"
    in the expression is invalid and will caused the error.
    In your scenario, please modify the second expression as below to avoid the error when there is no "/" in the string:
    =IIF(InStr(Fields!WellCompName.Value ,"/")=0,
    Fields!WellCompName.Value,
    left(Fields!WellCompName.Value,InStr(IIF(InStr(Fields!WellCompName.Value,"/")=0,"Test1/Test2",Fields!WellCompName.Value),"/")-1))
    Note: when WellCompName don't include "/" we given an test string "Test1/Test2" in the expression to avoid the error.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Help! My D400 Won't Boot And There Are No Error Codes!

    I put a Lenovo IdeaCentre D400 WHS into service 9 months ago and have had no real problems. I've only had to reboot it a couple times. This past month it has "disappeared" from our family network twice. Each time it returned to normal operation after shutting it down with the power button (4 seconds) and unplugging the power cord for 30 seconds and then reversing the process to start it back up.
    Last night it "disappeared" from our network again. This time it would not start back up after powering it down. When I press the power button to start it, the power LED lights up, then two blue LEDs and a red LED flicker for a millisecond, then the disk LED lights up for 12-13 seconds, then it (disk LED) flashes two times and never comes on again. The power LED remains lit but no other lights are on. Initially, I hear the fan(s) at high speed for about 5 seconds and then they idle down to slow (quiet). I hear what sounds like the disks (original 1TB drive and added 2TB WD Green drive) spinning and that sound doesn't change other than some quiet rhythmic ticking (every second or so). At no time have I had any indication that either of the drives could be having problems.
    The unforgivable thing is that I have some time-sensitive important files on the WHS that I hadn't taken the time to back up. I mistakenly thought they were as safe there as anywhere else I had available at the time.
    Can someone please help in the form of suggestions or direction?
    Whether I can get the D400 running again or not, what are the methods, if any, of copying the files off the hard drives that were married inside the WHS? Will any basic disk recovery tools such as GetDataBack work on these spanned drives?

    Hello mate,
    Remove the ram module and boot your computer. It sould beep at startup without ram, otherwise it's most likely a dead motherboard. Keep us posted.
    Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information on it.
    ThinkPad T510 4313-CTO Windows 8 x64 - Intel Core i7-620M - NVIDIA NVS 3100M - 8GB RAM - 240GB SSD- Intel Centrino Ultimate-N 6300 - Gobi 2000.
    ThinkPad Helix 3697-CTO Windows 8.1 x64 - Intel Core i7-3667U - Intel HD Graphics 4000 - 8GB RAM- 256GB SSD - Intel Centrino Advanced-N 6205 - Ericsson C5621gw

  • Vodafone India customer....on my iPhone5, imessage and facetime are giving error "waiting for activation"

    Hi
    I have iPhone 5 with Vodafone India connection. The major challenge is Facetimche & iMessage giving error "waiting for activation"
    I have tried all the available solutions in Google search but still no change.....
    Please help in getting this sorted out!!!
    Thanks
    Atin

    Level 1 (0 points)
    chakkochi 
    Re: My iMessage still says "Waiting for activation..." Jun 17, 2012 10:04 PM (in response to bradfromwinnipeg)
    Hi All,
    This problem is solved for me, with some help from the carriers. At last
    Let me describe my situation once again.
    I am from India, where the official iPhone carriers are Airtel and Aircel.
    I have two prepaid connections - One from Airtel and one from Reliance GSM
    Whenever I try to activate iMessage from my Reliace SIM, it shows activation unsuccessful, the the receive at shows my email ID only.
    But whenever I try activate it using Airtel SIM, it activates just fine. But since my primary connection is the Reliance one, I wanted it to get activated for Reliance.
    I have tried every tweaks/restore etc mentioned in this discussion, but nothing worked.
    The solution:
    This does not require any jailbreak/restore. Just a little help from the carrier.
    For all reliance GSM customers in India, you can just try to activate in again. I think they have solved it for all customers.
    I was almost lost hope of activating imeesage on Reliance. But then one of my friends bought a new iphone (4S). He had a docomo connection, and he also had this same issue. But using his contacts in docomo, he enabled some trace in his connection, and found out that the phone was trying to send SMS to a UK number (short code), which is blocked by their RA team.
    This is that magic number : 00445773142076
    So from him, I got the number. I raised a complaint with Reliance.
    The complaint had nothing about imessage, but it said: "I am unable to send international SMS to the number 00445773142076, even after having sufficient balance and an active SMS plan"
    So they have done some 'unblocking'  and called me this morning and asked to try again 'sending sms to the same number' . I went to settings and activated imessage and facetime/ Thats it !!!!.
    A big thanks to Reliance GSM support for the quick solution.
    For anyone on Reliance GSM in India, just try activating it now.
    For others, log a complaint with the carrier that "you want to send SMS to the number 00445773142076.
    Thanks all

  • Logic error in rotating a bot towards a target (switch from -180 to 180 and vice versa causes error)

    Hi,
    I am making a Bot class. This function rotateTo makes the bot rotate towards some coordinates, xTarget and yTarget.
    There are two targetRadians lines because it is easier to read for me.
    The target radians shows the angle of the target from the bot where the bot angle is this.angleRot.
    if the bot-angle minus the target-angle (it says in radians but is actually in degrees) is less than 0 it turns right and if it is greater than or equal to 0 then it turns left.
    public function rotateTo(xTarget, yTarget):Void {
                        targetRadians = Math.atan2(yTarget-this.yPos, xTarget-this.xPos);
                        targetRadians = Math.round(radiansToDegrees(targetRadians));
                        trace(targetRadians);
                                  if (this.angleRot-targetRadians<0) {
                                            turnBot(5);
                                  } else {
                                            turnBot(-5);
    This basically works. The bot rotates towards the target at 5 degrees per frame.
    The angle setup is that if the target x, y is below the bot x, y, the target angle is about 90, if it's to the right its about 0, if its above it's about -90 but as the angle is decreased to -180 from above to the left of the bot, when it goes below the bot (and to the left) the target angle switches to 180.
    So something like: with the bot in the middle and the target being located at one of the numbers;
              -90
    -180               -1
    180               1
               90
    The fact the target angle switches from -180 to 180 or 180 to -180 confuses the bot and the bot decides to turn ALL the way the opposite direction BECAUSE;
    if the bot angle is 160 and target angle is 175, the bot angle increases because target is greater than bot angle. If the target angle changes to -180, bot angle decreases even though it's more efficient to change from 160 to -180 through increasing the bot angle as at 180 it changes to -180. I just cannot work out the logic to use to make this work though.
    Any suggestions? Thanks.

    Hey I got it to work finally:
    public function rotateTo(xTarget, yTarget):Void {
                        targetRotation = Math.atan2((yTarget-this.yPos), xTarget-this.xPos)*180/Math.PI;
                        if (this.angleRot-targetRotation>180) {
                                  this.angleRot -= 360;
                        } else if (this.angleRot-targetRotation<-180) {
                                  this.angleRot += 360;
                        if (this.angleRot-targetRotation<0) {
                                  turnBot(5);
                        } else {
                                  turnBot(-5);
    so basically I added a couple of if statements before the main business.... I don't really have a coherent explanation for the fix but it works!

  • Videos are causing error

    When ever I download a video from my iphone or canon g11 ... Aperture locks up and does not respond to anything.  I have to force quit and reopen and try and find the video and delete it in the 5-10 seconds I have before it locks up.  This is new so I'm not sure what is going on.

    Had a similar problem...not sure if its the same one though. Videos (movies, TV) played fine on Itunes but then one day after I rented a movie all videos would cause the program to freeze and I would have to force quit. Tried uninstall-reinstall, download software updates and all that but nothing worked.
    What finally did work was I selected a video (movie, Mp4) that was not downloaded from Itunes store and not in my itunes library. I selected "open with" and then itunes and the movie loaded into the library and played great. Now everyting works fine and is back to normal. try this if you're not having luck with anything else.
    I have a macbook pro in case this makes any difference. Good Luck!

  • Nano will not sync had to restore and there are no error msg's!! pls i need my music back!

    i plug in my nano itunes comes up it shows that it is my ipod.. but there is no music on it since i did the restore.. before it would just start to sync but now it doesn't so i went to my ipod and clicked sync and nothing happens. please some give me some help!

    think i got it! thank for the look tho

  • Changes in RPCBURZ0 causes errors in other programs

    Hello to All,
    I made changes to RPCBURZ0 in order to extend the TABLE schema function to read a custom Infotype 9001.
    I added the necessary code in RPCBURZ0 and the data definition in RPCFDCZ0.
    The code is working perfectly , but the changes are causing errors in other country specific reports
    specifically in : HINCALC0 , HCNCALC0 , and HKRCALC0 and Transports to Quality generating errors.
    Error is because the custom infotype definition is not seen in these reports.
    Generation of the users of the transported Includes                                                                                |
    Program HCNCALC0, Include RPCBURZ0: Syntax error in line 000021
    The field 'T9001' is unknown, but there is a fieldwith the similar name 'T001P'. .
    Program HINCALC0, Include RPCBURZ0: Syntax error in line 000021
    The field 'T9001' is unknown, but there is a fieldwith the similar name 'T001P'. .
    Program HKRCALC0, Include RPCBURZ0: Syntax error in line 000021
           |   The field 'T9001' is unknown, but there is a fieldwith the similar name 'T001P'. . 
    Looking at other H--CALC0 reports i could easily spot an include for RPCFDCZ0.
    include rpcfdcz0.  "customer-specific data declaration (int'l)
    I wonder why this include is not in (HINCALC0 , HCNCALC0 , and HKRCALC0) !!!
    I have two solutions in mind :
    1. Make a custom ZRPCBURZ0 and include it in the main report.
    2. Look for user exist for the three reports and add the data definition statement .
    What is the best way to fix this situation ? and is there any other possible solutions ?
    We are using :
       SAP ECC 6.0
       Payroll International Driver.

    Alex Gorly and Matt Sullivan solved one of my issues above:
    Message: Attribute 'prod' is not declared for element 'prodname'
    I'm still stumpled on the other one:
    Message: Not enough elements to match content model  '(prodname,vrmlist,((brand|component|featnum|platform|prognum|series) )*)'
    As stated above, I've even removed everything from the general rule of <prodinfo> except prodname and I'm still getting the same error. I've searched everywhere for this general rule and <prodinfo> is the only place I can find it.
    What I really want is: (prodname), (vrmlist)?, (brand | component | featnum | platform | prognum | series)*
    so that vrmlist is optional.
    No matter what I do, unless I include a vrmlist, I get the above message. Currently, our CMS can't handle vrmlist but I don't want to remove it altogether because we may be replacing our CMS.
    Help please!

  • User32.dll Causing Error on Application Exit

    I have an application built into an exe with LabVIEW 8.2. It uses 1 simple call to user32.dll to determine if caps lock is on. When I build the application, it copies user32.dll to the 'data' subdirectory of my application. Everything works fine, however when I exit the program it throws a Windows error, "... has encountered a problem and needs to close..."
    Now the fun part. If I remove user32.dll from this directory, everything works fine. I guess it just goes out and finds the original user32.dll in the system directory and there are no errors when I exit. Replacing the file in \data causes the error again.
    The simplest thing would be to remove the call in my program as it isn't absolutely necessary (it just shows a warning when entering a password if caps lock is on), but there seems to be something weird going on because it only throws the error when using the dll it copied.
    Is there any way to stop the application builder from copying dlls? I couldn't find anything.
    Is there a way to force LabVIEW to release and cleanup any dlls it is using? If I could do this when the user exits, maybe whatever is causing this won't get left behind.

    Marc A wrote:
    I have an application built into an exe with LabVIEW 8.2. It uses 1 simple call to user32.dll to determine if caps lock is on. When I build the application, it copies user32.dll to the 'data' subdirectory of my application. Everything works fine, however when I exit the program it throws a Windows error, "... has encountered a problem and needs to close..."
    Now the fun part. If I remove user32.dll from this directory, everything works fine. I guess it just goes out and finds the original user32.dll in the system directory and there are no errors when I exit. Replacing the file in \data causes the error again.
    The simplest thing would be to remove the call in my program as it isn't absolutely necessary (it just shows a warning when entering a password if caps lock is on), but there seems to be something weird going on because it only throws the error when using the dll it copied.
    Is there any way to stop the application builder from copying dlls? I couldn't find anything.
    Is there a way to force LabVIEW to release and cleanup any dlls it is using? If I could do this when the user exits, maybe whatever is causing this won't get left behind.
    You should not copy system DLLs to other systems. That is a recipy for troubles. Make sure to reference user32.dll form inside the Windows System directory in your Call Library Node. LabVIEW will then see this as system library and not include it in the build. Any Windows system will have user32.dll in the system directory so there is really absolutely no need to distribute that with your app, (and actually it is legally not even correct).
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • ToString method why its not called implicitly for objects

    class Building { }
    public class Example
    public static void main()
    Building b = new Building();
    String s = (String)b;
    in the 5th Line it shows error that cannot cast building type to string..
    but all classes have the toString method which is called whenever we give the object arguement in System.out.println();
    the following code compiles
    class Building { }
    class Example
    public static void main()
    Building b = new Building();
    System.out.println(b);
    can anyone explain this?

    I get your point about casting.
    but in the println statement when u pass the building object it calls the toString method and generates a new string object
    why does not it do the same in the below code.
    String s = b;// b is a building object
    is the tostring method implicitly called only in println where it expects a string?

  • My external hard drives are causing problems when i capture DV in FCP

    We have external hard drives (2 different brands lacie and WD) are causing dropped frames when I capture DV in FCP. This only happens when they are connected via firewire 800. When I connect them using USB everything works great. Any ideas why this could be? We have 2 of each drive and 2 older mac pros and they both have this issue with every combination of drives I try. I've also tried reseting the ports with no luck...

    Connecting your camcorder to even 1 FW drive constitutes daisy-chaining.  Even if you have two FW ports in your Mac, connecting a drive to one port and your camcorder to the other is the same as daisy-chaining as far as  your Mac is concerned.
    Try capuring from your camcorder with no exernal FW drives attached.  Verify that works before trying anything else.
    Also, I noticed your profile says you have a Mac Pro.  You might consider adding a FW card in order to get extra FW ports that are not on the same FW bus as the built-in FW ports.  Then you could connect your external FW drives to the card; and your camcorder to the built-in ports and it should work.

  • Can't open safari. when I go to HD, then library...there is no input manager only input method and it is blank

    I can't open safari. I tried Mac HD to library...it does not show a input manager, only methods and there are no files associated with it. This just started this
    morning. Firefox works.

    Hi,
    There are two libraries. One is System one is your User account.
    InputManagers folder is in the system library.
    Open a Finder window. Select MacintoshHD in the Sidebar on the left. Now open the Library folder. The Input Managers folder is in there.
    I think you are looking in your "users folder" which you can access in the same Finder window by selecting your user account (it has a small house icon).
    I saw your post here.   https://discussions.apple.com/message/15025894#15025894
    If you think you have the Community Toolbar installed you need to check these folders.
    /Library/Application Support/ Move the Conduit file to the Trash.
    /Library/Application Support/ Move all of these files to the Trash: SIMBL/Plugins/CT2285220.bundle
    /Library/InputManagers/ Move CTLoader to the Trash.
    /Library/Receipts/ Move ctloader.pkg to the Trash.
    /Library/ScriptingAdditions/ Move any Conduit / CTLoader related files in that folder to the Trash.
    /Users/<User name>/Library/Application Support/ Move Conduit to the Trash.
    Carolyn  :-)

Maybe you are looking for

  • Load error in BI 7.0

    Dear SDN's, Today morning when i tried to upload costcentre transactional data into our BI 7.0 it went into error. I tried text file(flat file) which i saved in my desktop,not in application server. (1) RSA11 --> opened my data target and opened the

  • Specific header on a infotype

    Hi My company wants a specific header on a infotype. May i  know how to do it. Seema.

  • Flash installer wont event start

    i was trying to update my flash player because mozilla is starting to be unable to fully view some sites. i downloaded the installer but it wont start. i double clicked and nothing happened. nothing at all, not even an error message. i also tried uni

  • Getting prg name of assigned smartform

    hi experts, if i wanna know the z-smartforms assigned to a z-program.How can it be done?? ex : zmaterial1 is my smartform and it is called by prg zprg1.But after 2 days i forgot the prg and now i want to find the respective assigned program for this

  • MuVo TX stopped playing music works as memory storage o

    HiI had this MuVo TX for a while i have used in the early days as a mp3 player and later mostly as storage for files, now when i try to use it as MP3 it doesn't play or switch on, but works perfectly well as storage device. I have tried formatting. I