Results 1 to 2 of 2
- 10-30-2011, 06:21 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 1
- Rep Power
- 0
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 06:55 PM. Reason: code tags added
- 10-30-2011, 06:48 PM #2
Similar Threads
-
Make NetBeans use ANSI
By Pojahn_M in forum NetBeansReplies: 5Last Post: 08-05-2011, 03:36 AM -
netbeans-make jars-prb
By jlmp in forum Advanced JavaReplies: 8Last Post: 09-30-2010, 04:08 AM -
Can not make a runnable jar of my project
By liran in forum Advanced JavaReplies: 5Last Post: 05-18-2010, 11:25 AM -
How to make a function?
By mephisto772 in forum New To JavaReplies: 5Last Post: 02-23-2009, 09:51 AM -
How to make print function for single label?
By makpandian in forum AWT / SwingReplies: 2Last Post: 02-12-2009, 05:26 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks