Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91623700
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As