I have a Java question. (I'm using BlueJ.) I'm trying to program something that calculates pay roll. Most of it works, but I've identified two parts that don't: It labels all salaries as "Fulltime" no matter how many hours worked I input, and the do/while loop does something weird.
The if/else statement I have for the fulltime vs part time is:
if (hoursWorked < 40.0) {
position = partTime;
} else if (hoursWorked >= 40.0 || hoursWorked <= 168.0)
{
position = fullTime;
} else if (hoursWorked > 168.0) {
System.out.println("Error. Please try again.");
}
And the do/while loop ends with:
} while (employeeName != "Exit");
When the loop comes back around, it prints:
Employee name: Base pay rate:
And then fails no matter what I put. For that part I have:
System.out.print("Employee name: ");
employeeName = read.nextLine();
System.out.print("Base hourly pay: ");
baseSalaryPay = read.nextDouble();
System.out.print("Hours worked: ");
hoursWorked = read.nextDouble();
What do I need to fix?
There are two major fix here:
Note: please share the complete code next time
Please feel free to ask if you have any doubt and share the feedback too.
I have a Java question. (I'm using BlueJ.) I'm trying to program something that calculates pay...
Must be written in java. Modularize the following code. //CIS 183 Lab 4 //Joseph Yousef import java.util.*; public class SalaryCalc { public static void main(String [] args) { Scanner input = new Scanner(System.in); int sentinelValue = 1; //initializes sentinelValue value to 1 to be used in while loop while (sentinelValue == 1) { System.out.println("Enter 1 to enter employee, or enter 2 to end process: "); sentinelValue = input.nextInt(); input.nextLine(); System.out.println("enter employee name: "); String employeeName = input.nextLine(); System.out.println("enter day...
I am trying to modify this program so that it stores the employee's name in a c-string and can handle up to 100 employees (so it would mostly be a partially filled array), but I cannot get it to work. It works with two files that it is suppose to read input from. Then it prints output to an output file. Employee Info File (first file read, M/F should be ignored): 5 Christine Kim 30.00 2 1 F 15 Ray...
I need this java program to contain methods that do some of the work that can be modularized. It must logically be the same as this loop program but instead the logic will be modularized into Java Methods. Continue to take input for every employee in a company, and display their information until a sentinel value is entered, that exits the loop and ends the program. import java.util.Scanner; public class SalaryCalc { double Rpay = 0, Opay = 0; void...
My Java code from last assignment:
Previous Java code:
public static
void main(String args[]) {
// While loop set-up
boolean flag = true;
while (flag) {
Scanner sc = new
Scanner(System.in);
// Ask user to enter employee number
System.out.print("Enter employee
number: ");
int employee_number = sc.nextInt();
// Ask user to enter last name
System.out.print("Enter employee last
name: ");
String last_name = sc.next();
// Ask user to enter number of hours worked
System.out.print("Enter number of
hours worked: ");
int hours_worked =...
My Java code from last assignment:
Previous Java code:
public static
void main(String args[]) {
// While loop set-up
boolean flag = true;
while (flag) {
Scanner sc = new
Scanner(System.in);
// Ask user to enter employee number
System.out.print("Enter employee
number: ");
int employee_number = sc.nextInt();
// Ask user to enter last name
System.out.print("Enter employee last
name: ");
String last_name = sc.next();
// Ask user to enter number of hours worked
System.out.print("Enter number of
hours worked: ");
int hours_worked =...
the question just that. here is what i have done, put
something wrong with it
Week 5- Counts using While or Do-While Loop Write a program that asks the user to input 6 integer numbers, then the program counts the number of negative numbers, the number of positive numbers and counts the number of zeros. Use 'while' loop or 'Do-While loop in your program. Make sure to include comments in the program. Example, if the input numbers are: -23 Then,...
Hello, I am trying to get this Array to show the summary of NETPAY but have been failing. What is wrong? #include <iostream> #include <iomanip> using namespace std; main(){ char empid[ 100 ][ 12 ]; char fname[ 100 ][ 14 ], lastname[ 100 ][ 15 ]; int sum; int hw[ 100 ]; double gp[ 100 ], np[ 100 ], hr[ 100 ], taxrate[100], taxamt[ 100 ]; int counter = 0; int i; cout<<"ENTER EMP ID, FNAME, LNAME, HRS...
THIS IS WHAT I HAVE I NEED TO FIX IT SO:
hours_worked should not be inputed separately.
Get the hours as 40 40 40 40 or 40, 40, 40, 40 whichever
separator suits you.
How do I do this?
How would you change what I have in to it getting into that kind
of input.
Thank you!
class Employee:
again = 'y'
def __init__(self):
self.__rate = 7.25
self.__totalhour = 0
self.__regularpay = 0
self.__overtimepay = 0
self.__totalpay = 0
self.__tax...
Please include function in this program
Write a C program that will calculate the gross pay of a set of employees utilizing pointers instead of array references. You program should continue to use all the features from past homeworks (functions, structures, constants, strings). The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. The program determines the overtime hours (anything over 40 hours), the gross pay and...
I need help making this work correctly. I'm trying to do an array but it is drawing from a safeInput class that I am supposed to use from a previous lab. The safeInput class is located at the bottom of this question I'm stuck and it is not printing the output correctly. The three parts I think I am having most trouble with are in Bold below. Thanks in advance. Here are the parameters: Create a netbeans project called ArrayStuff...