Reference no: EM13952869
Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee, the hourly rate, and the number of hours worked for that week. The application should then print out the name of the employee and the weekly pay amount. In the print out, display the dollar symbol ($) to the left fo the weekly pay amount and formate the weekly pay amount to display currency. Also have the application to continue to request employee information until the user enters "stop" as the employee name. Have the program to check 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, teh application should prompt the user to enter a positive amount. The program should use a class to store or 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 withing that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate.
Please keep this as simple as possible, no fancy stuff. No boolean, keep as one program by renaming the class within the class, no private static void. Very very very basic program with printf. Please! No buffered reader either. I cannot express simply simply simply and basic to much here! I'm a beginner programmer and need to see the basic before jumping into deep. A scanner is fine! I have included an attachment so you get the idea of how basic.
No, the new class will not be contained within the main method and you do not have to put it in a file of its own.
Yes, you are to create a main method that will create an instance of the class. The class should contain a constructor and a method that performs all of the functionality of the previous program.
Here is a brief example:
public class WeeklyPayroll
{
public static void main (String args[ ])
{
PayrollClass myPayroll = new PayrollClass ( );
} // end of main method
class PayrollClass ( )
{
declare variables
create constructor
}// end of Payroll class
}// end of WeeklyPayroll
Step 1: create a class declaration. If you create a class in the same program as the main the declaration might look something like this:
class NewClass
{
You will need to move all of the variables declared in the main to here.
Step 2: after the class and variable declaration you will create a constructor. Remember that a constructor is executed when you create a new object from a class. Constructors are declared just like other methods except that they have exactly the same name as the class. The constructor will come right after the declaration of the variables.
class NewClass
{
You will need to move all of the variables declared in the main to here.
public NewClass( )
{
You do not have to put anything in this constructor unless you are passing values to your variables. In this case, we are not.
}// end of constructor
} // end of NewClass
Step 3: now that you have your class created, we have to create a method that will calculate the weekly pay. We will declare this method void because this method will before a task but will not return any information when it completes the task. We will want to move everything contained in the outer while loop to this method that will immediately follow the constructor.
Step 4: the main method now has no statements. We will add only two statements. The first will be the statement that creates a new object and the second statement will call the method to calculate the weekly pay.
I'm not asking anyone to do the work I have attached what I have in payroll4.java I cannot get to compile. Please help!
Scanner should be fine.
Attachment:- payroll2.zip
Calculate the estimated median
: A sample of data was selected from a population: {195, 179, 205, 213, 179, 216, 185, 211}. Use the deviation score method and the calculation formula to calculate variance and standard deviations.
|
What should the audience patron
: What should the audience patron, who is seeing this kind of theatre supposed to thinkwhen they leave the theatre? (what is it about? war, humanity, religion?)
|
How are the factors that are not controlled dealt with
: At the end of the year, an achievement test is administered and the two groups are compared- Is this an experiment or an observation and If it's an experiment, what is the response variable? If it's an observation, what are they observing?
|
Integrative studies in human resources development
: Gulfport Transit is the main public transportation authority in the Tampa, Florida Metroplex. It operates buses within Tampa, Sarasota, Clearwater, and Bradenton, Florida, and provides regular service to Sarasota Bradenton International Airport, S..
|
Create a non-gui based java application
: Yes, you are to create a main method that will create an instance of the class. The class should contain a constructor and a method that performs all of the functionality of the previous program.
|
How are the mean, median, and mode interrelated
: How are the mean, median, and mode interrelated? What considerations lead to the choice of one of these measures of location over another?
|
What is meant by a measure of location
: What is meant by a measure of location? State in your own words the defini- tions of the following measures of location:- Arithmetic mean, Median and Mode
|
Prepare a list of the different kinds of costs
: Prepare a list of the different kinds of costs that a company might incur as part of its "total package" salary cost.
|
Find the seasonal median number of home runs for each player
: For each player, determine the minimum, the first quartile, the median, the third quartile and the maximum of their home run totals. Use these results to construct comparative box-and-whisker plots.
|