Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: tberger1
  • Order by date
  1. tberger1

    If statement

    I am having a block - I am writing a program that will receive a series of numbers entered in by the user. I need to test to make sure that the number is not negative but also that I truly have a number (not a letter or special character). The first part is easy if (numbEntered[x] <0)...
  2. tberger1

    Help with out put

    Thank you so much for your words of wisdom. I actually figured it out - there was an existing array at the beginning of my class that I was able to call in. I always look at things the hard way. Also I should probably just point out that I am taking a workshop to learn java - it is a no...
  3. tberger1

    Help with out put

    I have to set it up this way because it is an assignment. I am suppose to make the toString method print out the column headings and then populate the data that follows. I guess my biggest problem is how to get the data from another method into the different subsets of the array. I have tried...
  4. tberger1

    Help with out put

    Thanks for the responses. Bob, This array is where I am struggling. Do I call the methods for getting the month, getting the data and calcualting into the subsets of the array? This should probably be the easy part but it is just not clicking.
  5. tberger1

    Help with out put

    I am trying to write a program where the user enters in the average and actual rainfall amounts for 12 months. Then the system will display the month, actual, average and the difference in a table layout - Month Actual Average Difference Jan 5 3 2 Feb...
  6. tberger1

    converting a static method

    I have a static method I wrote: public static Money add(Money money1, Money money2) { int newDollars = money1.getDollars() + money2.getDollars(); int newCents = money1.getCents() + money2.getCents(); if (newCents >= 100) { newDollars++; newCents -= 100; } return new Money(newDollars...
  7. tberger1

    Compile error on accessor method

    Thanks for that - I changed them to public void and it is now compiling. Appreciate the help - hopefully I can get through the rest on my own.
  8. tberger1

    Compile error on accessor method

    I tried that - now I get this compile error: C:\Documents and Settings\NextStep\Desktop\OdometerA.java:13: missing return statement } ^ C:\Documents and Settings\NextStep\Desktop\OdometerA.java:18: missing return statement } ^ C:\Documents and...
  9. tberger1

    Compile error on accessor method

    I am trying to write a get method: public void getGasConsumed() { int gals = miles/fuelEffiency; return gals; } when I try to compile it I get the following error: cannot return a value from method whose result type is void return gals; I am not understanding the problem - any help...
  10. tberger1

    Help with Get and Set Methods

    I have a program that I need to convert the existing methods to get and set methods but I am struggling with how to do this. I have one set in place. Can anyone help in changing some of the others to get or set as appropriate? Any help is appreciated. TJ Here is the code: import...
  11. tberger1

    Compile Error

    I am trying to right a program that calculates MPG of a car and then resets the odometer. I set up a class for the odometer and then am trying to call in the different methods into main. Here is the odometer class: import java.util.Scanner; public class Odometer { public int milesDriven...
  12. tberger1

    Compile Error

    I am trying to right a program that calculates MPG of a car and then resets the odometer. I set up a class for the odometer and then am trying to call in the different methods into main. Here is the odometer class: import java.util.Scanner; public class Odometer { public int milesDriven...
  13. tberger1

    Math Logic Error

    I am writing a program that based on what you enter will determine how much your change will be - it then displays the total of each coin. The problem is my math - the dimes are not computing right so it gives back more nickles then necessary. Can someone set me straight here. I think other...
  14. tberger1

    Error - start of expression

    Thank you for your help - I have it working!!!!!
  15. tberger1

    Error - start of expression

    I changed it to use the replaceFirst: /** Replaces the first occurrence of "hate" in a String with the word "love". */ public class LoveHate { /** The String in which a word is to be replaced */ public static final String ORIGINAL = "I hate you."; public static void...
  16. tberger1

    Error - start of expression

    I am new to Java so I am trying to write some simple applications that I will need to enhance later for a new project I need to implement. The program I am writing should be simple. It removes one word from a statement and changes it with another. I thought a simple getChars would do it but...

Part and Inventory Search

Back
Top