JAVA ONLY
I have a programming project, and I have to create a method called String computePay(double hours) - computes the weekly pay for a Worker. Returns the output as a String that always displays the result to 2 decimal points. This is what I have done thus far... Can you help?
public class Worker{
private String name;
private double salaryrate;
private double a;
public void Gavin(String uname, double usalaryrate){
name=uname;
salaryrate=usalaryrate;
}
public String computePay (double hours){
a= hours* salaryrate + 0.01 - 0.010;
return decimalpoint(a);
}
public String decimalpoint(double x){
String gavin= x+ "";
String fgavin="";
for (int bob=0; bob<gavin.length();bob++){
if (bob+3>gavin.length())
fgavin = gavin.substring(0,bob+2);
else
fgavin = gavin.substring(0,bob++);
}
return fgavin;
}
}
CODE
=============
public class Worker {
private String name;
private double salaryrate;
private double a;
public void Gavin(String uname, double usalaryrate){
name=uname;
salaryrate=usalaryrate;
}
public String computePay (double hours){
a= hours* salaryrate + 0.01 - 0.010;
return String.format("%.2f", a);
}
}
JAVA ONLY I have a programming project, and I have to create a method called String...
Java. Java is a new programming language I am learning, and so far I am a bit troubled about it. Hopefully, I can explain it right. For my assignment, we have to create a class called Student with three private attributes of Name (String), Grade (int), and CName(String). In the driver class, I am suppose to have a total of 3 objects of type Student. Also, the user have to input the data. My problem is that I can get...
I need help with this one method in java. Here are the guidelines. Only public Employee[] findAllBySubstring(String find). EmployeeManager EmployeeManager - employees : Employee[] - employeeMax : final int = 10 -currentEmployees : int <<constructor>> EmployeeManager + addEmployee( type : int, fn : String, ln : String, m : char, g : char, en : int, ft : boolean, amount : double) + removeEmployee( index : int) + listAll() + listHourly() + listSalary() + listCommision() + resetWeek() + calculatePayout() :...
How can I write a unit test for the following java method? (I am using intelliJ) public class ReviewEmployee{ public void EmployeeReview(Employee currentEmployee){ System.out.println("Your recorded hours for the week are: ") + (currentEmployee.getHours()); System.out.println("Your satisfactory rating is: ") + (currentlyEmployee.getRating()); System.out.println("Your bonus is: "); if(currentEmployee.getRating() < 3){ System.out.println(currentlyEmployee.getBonus()); } else{ System.out.println(currentlyEmployee.getBonus() + 500); } } } The Employee class is as follows: Public class Employee{ Private double hours; Private double rating; Private double bonus; Public Employee(double...
How to create a constructor that uses parameters from different classes? I have to create a constructor for the PrefferedCustomer class that takes parameters(name, address,phone number, customer id, mailing list status, purchase amount) but these parameters are in superclasses Person and Customer. I have to create an object like the example below....... PreferredCustomer preferredcustomer1 = new PreferredCustomer("John Adams", "Los Angeles, CA", "3235331234", 933, true, 400); System.out.println(preferredcustomer1.toString() + "\n"); public class Person { private String name; private String address; private long...
JAVA project PLEASE complete/ create project with comments in
the programming explaining everything
Text file
Year of storm/ Name of storm/ mmdd storm started/ mmdd storm
ended/ magnitude of storm/ //made up data
2004/Ali/1212/1219/1
2003/Bob/1123/1222/3
1980/Sarah/0123/0312/0
1956/Michael/1211/1223/4
1988/Ryan/0926/1019/
1976/Tim/0318/1010/0
2006/Ronald/0919/1012/2
1996/Mona/0707/0723/1
2000/Kim/0101/0201/1
2001/Jim/1101/1201/3
Text file
Class storm{
private String nameStorm;
private int yearStorm;
private int startStorm;
private int endStorm;
private int magStorm;
public storm(String name, int year, int start, int end, int
mag){
nameStorm = name;
yearStorm = year;
startStorm...
Given attached you will find a file from Programming Challenge 5 of chapter 6 with required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: An empty string is given for the employee’s name. An invalid value is given to the employee’s ID number. If you implemented this field as a string, then an empty string could be invalid. If you implemented this field as a numeric variable, then a...
******Java Programming Hi guys, I really need you help. I created a code for my java course, but it keep giving me error messages. Majority of my code is fine but some keep display error on my console. I was hoping someone could pin points the problem. .There are three classes with the testCenter class being the main class. In the following is the assignment, and the bottom is my code. Please help! Assignment: Concepts: GUI User Design Graphics Deployment...
I was wondering if I could get some help with a Java Program
that I am currently working on for homework. When I run the program
in Eclipse nothing shows up in the console can you help me out and
tell me if I am missing something in my code or what's going
on?
My Code:
public class Payroll {
public static
void main(String[] args) {
}
// TODO Auto-generated method stub
private int[] employeeId = {
5658845, 4520125, 7895122,...
I have a java class that i need to rewrite in python. this is what i have so far: class Publisher: __publisherName='' __publisherAddress='' def __init__(self,publisherName,publisherAddress): self.__publisherName=publisherName self.__publisherAddress=publisherAddress def getName(self): return self.__publisherName def setName(self,publisherName): self.__publisherName=publisherName def getAddress(self): return self.__publisherAddress def setAddress(self,publisherAddress): self.__publisherAddress=publisherAddress def toString(self): and here is the Java class that i need in python: public class Publisher { //Todo: Publisher has a name and an address. private String name; private String address; public Publisher(String...
Thank you in advance. Create a class called Main and write the main method. I need help with calling the printChart method Declare a variable to hold the grade as it is read in Declare 5 variables to hold counts to count the number of As, Bs, Cs, etc declare a variable to hold the class name and ask the user to enter the name of the class whose grades are going to be entered. Write a loop that reads...