here are a couple of questions i tried doing but not sure if they are correct. if anyone could please help with with them that would be great.. thanks
An Employee will have a name, social security number, position, and hourly wages. Define the instance data for this class
Answer:
employeeName=na me;
employeePositio n=position;
hourlyWage=wage ;
socialSecurityN umber=ssn;
Write a method that is passed the int value of the number of hours worked for the week as a parameter, and returns the pay for the Employee (including overtime, which is 1.5 * hourly wages for each hour over 40).
Answer:
public double pay (double hours)
{
if(hours<=40)
pay=hours*wage;
else
pay=1.5*wage*ho urs;
return pay;
}
Write a raise method that is passed an increase (or decrease) in hourly wages and updates the Employee’s hourly wages appropriately. The amount passed is strictly the amount of increase or decrease, not a new hourly wage. If the amount of increase (or decrease) is too much (more than what the Employee currently makes) do not adjust the hourly wage, but instead output a warning message.
Answer:// this one im not sure about
public rasie(double increase, double decrease)
{
if(decrease<=Ma th.abs(wage))
System.out.prin tln("Warning amount is less than what employee makes");
else
raise=increase+ wage;
}
1 5759
here are a couple of questions i tried doing but not sure if they are correct. if anyone could please help with with them that would be great.. thanks
An Employee will have a name, social security number, position, and hourly wages. Define the instance data for this class
Answer:
employeeName=na me;
employeePositio n=position;
hourlyWage=wage ;
socialSecurityN umber=ssn;
Write a method that is passed the int value of the number of hours worked for the week as a parameter, and returns the pay for the Employee (including overtime, which is 1.5 * hourly wages for each hour over 40).
Answer:
public double pay (double hours)
{
if(hours<=40)
pay=hours*wage;
else
pay=1.5*wage*ho urs;
return pay;
}
Write a raise method that is passed an increase (or decrease) in hourly wages and updates the Employee’s hourly wages appropriately. The amount passed is strictly the amount of increase or decrease, not a new hourly wage. If the amount of increase (or decrease) is too much (more than what the Employee currently makes) do not adjust the hourly wage, but instead output a warning message.
Answer:// this one im not sure about
public rasie(double increase, double decrease)
{
if(decrease<=Ma th.abs(wage))
System.out.prin tln("Warning amount is less than what employee makes");
else
raise=increase+ wage;
}
-
-
public class Employee {
-
//I think they also wanted the data types
-
String name;
-
String socialSecurityNumber;
-
String position;
-
double hourlyWages;
-
double pay;
-
public Employee(String name, String ssn, String pos, double hWages) {
-
this.name = name;
-
socialSecurityNumber = ssn;
-
position = pos;
-
hourlyWages = hWages;
-
}
-
public double getPay(double hours) {
-
double overtimeHours = 0.0;
-
if(hours > 40) {
-
overtimeHours = hours - 40;
-
}
-
pay = hours * hourlyWages;
-
pay = pay + overtimeHours * hourlyWages * 1.5;
-
return pay;
-
}
-
public void raise(double amount) {
-
if(Math.abs(amount) > pay) {
-
System.out.println("Warning amount is greater than what employee makes");
-
}
-
else {
-
hourlyWages = hourlyWages + amount;
-
}
-
}
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jonas Cord |
last post by:
Hi, I'm trying to learn proxy classes in C++ so I've written the
following code, trying to modify an example given in Deitel & Deitel's
C++ book.
I am trying to "hide" details of the original class (employee.h)
through a proxy class (employeeproxy.h).
What am I doing wrong? Please help... I will be grateful forever.
employee.h
----------
|
by: Zambien |
last post by:
Hi all,
Here's my problem. I have tables that are using the menu/submenu idea
for hiding rows. This works fine in IE (of course) and does show/hide
correctly in netscape, but as soon as the shown method is called, the
table gets skewed and the presentation of the data on the page goes
horribly wrong. I don't think this is a table issue as I have spent
alot of time staring at this code. Here is the html...
|
by: x muzuo |
last post by:
Hi guys,
I have got a prob of javascript form validation which just doesnt work
with my ASP code. Can any one help me out please.
Here is the code:
{////<<head>
<title>IIBO Submit Page</title>
</head>
<style type="text/css">
|
by: Noel |
last post by:
Hello,
I'm currently developing a web service that retrieves data from an employee
table. I would like to send and retrieve a custom employee class to/from the
webservice. I have currently coded the custom employee class and have built
it as a separate library (employee.dll). This employee.dll is being
referenced by both the web service and the windows application.
I face the following problem when I send this class to the webservice.
|
by: mopicus |
last post by:
hello all, i have two base classes, one inherits from bindinglist<>
i need baseobject contains a generic reference to collection that contains it
class baseobject<T> : where T:baseobjectcollection<baseobject<T>>
class baseobjectcollection<T> : BindingList<T> where
T:baseobject<baseobjectcollection<T>>
i'm getting compile error with this. i'm not sure if it's a syntax error or
what i'm trying it's impossible, without generics of...
| |
by: jhhbr549 |
last post by:
Need to write a class called Sales that is extends from a super class called Employee.
I feel like I am going in the wrong direction. look at this:
Here are the specs:
static double field values - BEST_COMMISSION, HIGH_COMMISSION, HIGH_SALES, LOW_COMMISSION,LOW_SALES, QUOTA_COMMISION, QUOTA_SALES.
I believe I have the main constructor correct?
Method - getCommissionRate( )
|
by: ycg0771 |
last post by:
I'm trying to modify the following program so that it uses a class to store
and retrieve the employee's name, the hourly rate, and the number of
hours worked. Use a constructor to initialize the employee information,
and a method within that class to calculate the weekly pay. It seems that the more I read into this, the more confused I get. Any help will be greatly apreciated.
Here is my latest code...
// Payroll program that...
|
by: tikney5 |
last post by:
I need to modify my current program so that is uses a class to store and retrieve the employees name, hourly rate, and number of hourse worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name the application should terminiate. Below is my previous code and some of what I think I need for this assignment. Any help would be great....
|
by: bhipwell via AccessMonster.com |
last post by:
Hello,
I have developed an employee benefits database that currently contains over
3000 employees and 70+ companies. Having started the database as a really
simple solution for our clients, the last six months have demanded more
complexity and thus much of the recent work has been patch work to say the
least. I finally hit the "too many fields defined error" and now is the time
to go back and rebuild part of the database resulting from...
|
by: TeeTea02 |
last post by:
Create a class called Employee. An Employee should have four pieces of information as instance variables – first name (type String), last name (type String), monthly salary (type double), and dependents(type int). Your class should have a constructor that initializes the four instance variables. Provide a get and set method for each instance variable. In addition, provide a method named getAnnualSalary that determines the annual salary of the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |