Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Modifythe Payroll Program application so it continues to request employee information until the user entersstop as the employee name. In addition, program the application to check that the hourly rate and number of hours worked are positive numbers. If either the hourly rate or the number of hours worked is not a positive value, the application should prompt the user to enter a positive amount. I have completed part 1 of thi assignment

OpenStudy (anonymous):

HI have so far: /* * import java.scanner.*; * To change this template, choose Tools | Templates * and open the template in the editor. */ package weeklypay2.java; /** * * @author Dennis L. Mason */ public class WeeklyPay2Java { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here // public static void main(String[] args) { // String name; // double rate; // double hours; // double pay; // Scanner input = new Scanner(System.in); System.out.println("Welcome to the payroll program\n"); System.out.println("Dennis:"); // fname = input.nextLine(); System.out.println("$20.00:"); // rate = input.nextDouble(); System.out.println("40 hours:"); // hours = input.nextDouble(); // pay = rate * hours; // System.out.println("\nName: " + name); // System.out.println("Hourly rate: $" + rate); // System.out.println("Hours worked: " + hours); // System.out.println("Total pay: $" + pay); } }

OpenStudy (konradzuse):

for this you are going to need to set up arrays for the name, hourly rate, hours worked, and total pay. Normally we can use arrays, but since we have no limit to our data, we should use an arraylist. Arraylist name = new Arraylist() Etc then while(input.next != "stop) { //get the info } else { stp }

OpenStudy (anonymous):

I have revised this program that runs and compiles, I need help filling in the spaces between the commas,: /* * import java.scanner.*; * To change this template, choose Tools | Templates * and open the template in the editor. */ package weeklypay2.java; /** * * @author Dennis L. Mason */ public class WeeklyPay2Java { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here // public static void main(String[] args) { // String name; // double rate; // double hours; // double pay; // Scanner input = new Scanner(System.in); System.out.println("Welcome to the payroll program\n"); System.out.println("Dennis:"); // fname = input.nextLine(); System.out.println("$20.00:"); // rate = input.nextDouble(); System.out.println("40 hours:"); // hours = input.nextDouble(); // pay = rate * hours; // System.out.println("\nName: " + name); // System.out.println("Hourly rate: $" + rate); // System.out.println("Hours worked: " + hours); // System.out.println("Total pay: $" + pay); } } //import java.io.BufferedReader; //import java.io.IOException; //import java.io.InputStreamReader; //import java.text.NumberFormat; //import java.util.StringTokenizer; //class ComputeSalary2 { //public static void main(String[] args) { //String employee; //double hours = 0, rate = 0; //boolean hours_valid = false, rate_valid = false; //System.out.print("Dennis: "); //employee = Input.readString(weeklypay2.java;); //while (employee.equals("stop")) { //System.out.print("Dennis: "); //employee = Input.readString(); //continue; // hours worked //while (!hours_valid) { //System.out.print("How many hours did " + employee + " work? "); ///hours = Input.readDouble(); //while (hours < 0) { //System.out.print("Enter proper number of hours: "); //hours = Input.readDouble(40); //continue; //hours_valid = true; /*}*/ // rate //while (!rate_valid) { //System.out.print("How much does " + employee + " make per hour? "); //rate = Input.readDouble(); //while (rate < 0) { //System.out.print("Enter proper number for rate: "); //rate = Input.readDouble(); //continue; /*}//*/ //rate_valid = true; /*}*/ // compute pay check //double pay = rate * hours; //NumberFormat fmt = NumberFormat.getCurrencyInstance(); ////System.out.println("\n" + employee + " worked for " + hours //+ " hours at " + fmt.format(rate) + "/hr; paycheck = " //+ fmt.format(pay)); /*}*/ /*}*/ //public class Input { //static private StringTokenizer stok; //static private BufferedReader br = new BufferedReader( //new InputStreamReader(System.in)); //public static int readInt() { //int i = 0; //try { //String str = br.readLine(); //StringTokenizer stok = new StringTokenizer(str); //i = new Integer(stok.nextToken()).intValue(); //} catch (IOException e) { //System.out.println(e);} //return i; /*}*/ //public static double readDouble() { //double d = 0; //try { //String str = br.readLine(); //stok = new StringTokenizer(str); //d = new Double(stok.nextToken()).doubleValue(); //} catch (IOException e) { //System.out.println(e); /*}*/ //return d; //public static String readString() { //String str = ""; //try { //str = br.readLine(); //stok = new StringTokenizer(str); //} catch (IOException e) { //System.out.println(e); //return str;

OpenStudy (anonymous):

I meant pparentheses, sorry

OpenStudy (anonymous):

Here is my print out so far: run: Welcome to the payroll program Dennis: $20.00: 40 hours: BUILD SUCCESSFUL (total time: 0 seconds)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!