Results 1 to 2 of 2
  1. #1
    emberato is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Default How to make my project function using Netbeans

    Below is code I have written for a project. I have no errors showing but still can not get the program to function. I have saved, compiled and the try to run but only shows in the output window 2 things,
    run:
    BUILD SUCCESSFUL (total time: 0 seconds)
    what may I be doing incorrectly?

    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package payprogram1;
    
    import java.util.Scanner;
    
    /**
     *
     * @author Tom
     */
    public class PayProgram1 {
    
        /**
         * @param args the command line arguments
         */
        // main method begins execution of Java application
        
        public static void main(String[] args) {
            
            // create Scanner to obtain input from command window
            
        }
    
        {
            Scanner input = new Scanner(System.in);
            boolean enterMoreData = true;
            while (enterMoreData) {
                System.out.println("Enter employee name: "); // prompt
                String theName = input.nextLine();
                if (theName.equalsIgnoreCase("stop")) {
                    input.close();
                    break;
                }
                int hoursWorked;
                do {
                    System.out.println("Enter hours worked: "); // prompt
                    String line = input.nextLine();
                    hoursWorked = Integer.parseInt(line);
                    if (hoursWorked < 0) {
                        System.out.println("number must be positive");
                    }
                } while (hoursWorked < 0);
                int hourlyPayRate;
                do {
                    System.out.println("Enter rate of pay: "); // prompt
                    String line = input.nextLine();
                    hourlyPayRate = Integer.parseInt(line);
                    if (hourlyPayRate < 0) {
                        System.out.println("number must be positive");
                    }
                } while (hourlyPayRate < 0);
    // multiply hours worked * hourly pay rate
                int weeklyPay = hoursWorked * hourlyPayRate;
    // display employee name and weekly pay total
                System.out.printf("Employee Name: %s, Weekly pay is $%d%n",
                        theName, weeklyPay);
            }
        }
    }
    Last edited by Fubarable; 10-30-2011 at 07:55 PM. Reason: code tags added

  2. #2
    jMaster's Avatar
    jMaster is offline Member
    Join Date
    Oct 2011
    Posts
    16
    Rep Power
    0

    Default Re: How to make my project function using Netbeans

    There is nothing in your main method.

Similar Threads

  1. Make NetBeans use ANSI
    By Pojahn_M in forum NetBeans
    Replies: 5
    Last Post: 08-05-2011, 04:36 AM
  2. netbeans-make jars-prb
    By jlmp in forum Advanced Java
    Replies: 8
    Last Post: 09-30-2010, 05:08 AM
  3. Can not make a runnable jar of my project
    By liran in forum Advanced Java
    Replies: 5
    Last Post: 05-18-2010, 12:25 PM
  4. How to make a function?
    By mephisto772 in forum New To Java
    Replies: 5
    Last Post: 02-23-2009, 10:51 AM
  5. How to make print function for single label?
    By makpandian in forum AWT / Swing
    Replies: 2
    Last Post: 02-12-2009, 06:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •