User Profile

Collapse

Profile Sidebar

Collapse
miller587
miller587
Last Activity: Apr 10 '08, 01:30 PM
Joined: Nov 3 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • miller587
    started a topic using package in main() method
    in Java

    using package in main() method

    I am trying to format numbers in an output using 3 sub classes and methods. Having trouble. I am using a package to do this I have imported the package. Any thoughts would help.
    See more | Go to post

  • miller587
    replied to Using hasNextInt()
    in Java
    thanks for the interpetation I have used C in past makes sense. thanks, for helping me out
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    Not quite sure what I should tag as [CODE]

    Error reads as follows: variable numHammers might not have been initialized
    totalCost = (numHackSaws*HA CKSAW_COST) + (numHammers*HAM MER_COST) +

    I am only trying to determine if user put an int when asked for number of 2nd item.

    I have never used any of the scanner methods to check validation of input
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    import java.util.Date;
    import java.util.Scann er;

    class JohnVanHoutanP2
    {
    Code:
    private static final double HACKSAW_COST = 15.99;		//class constants
    	  private static final double HAMMER_COST = 12.18;
    	  private static final double HARDHAT_COST = 18.75;
    	  private static final double DRILL_COST = 19.99;
    	  private static final double SAFETYGOGGLES_COST = 16.47;
    	  private static final
    ...
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    To use hasNextInt() in scanner class to validate input do I have to add in a range check for this to work.
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    I got 5 Items that user inputs amount of product he or she wants, only trying to determine if user enters an int when entering number for second product. I have been searching all over net for examples. I am sure I am missing something simple. I get an error saying numHammers not intailized. Puzzeled. Here is my input of code.

    System.out.prin t("How many Hacksaws? ");
    numHackSaws = input.nextInt() ;...
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    your saying in loop I must initialize numHammers to a number
    See more | Go to post

    Leave a comment:


  • miller587
    replied to Using hasNextInt()
    in Java
    Thanks have fixed problem, but now I have error that my varaible might not have been intialized looking for numHammers which is my int. I new to java and trying to learn this.
    See more | Go to post

    Leave a comment:


  • miller587
    started a topic Using hasNextInt()
    in Java

    Using hasNextInt()

    Trying to code in hasNextInt() for data type checking. Basicall my code ask user for input and if user doesn't use an int they get an error. I know i should have a if and else statement with this.
    I am trying this data type checking in this block of code and I get tons of errors

    while (isValid==false )
    }
    System.out.prin t("How many Hammers? ");
    if(input.hasNex tInt())...
    See more | Go to post

  • New to Java, my teacher has confused me with detail line

    In a program with parent and child classes she has asked me to print a detail line with 3 objects. Line should print name, type of object "which is a toString()", total of tuition and books. Is this the the same as I have been doing like:
    ScholarshipStud ent student 1 = new ScholarshipStud ent ( "", "Joe", etc, etc.)
    then later I will create this to print in output.
    See more | Go to post
No activity results to display
Show More
Working...