Create a non-gui based java application

Assignment Help Programming Languages
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

Reference no: EM13952869

Questions Cloud

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.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write pseudo code to put scores until e button is hit

The program will keep on prompting you to put more scores until you hit E button on your keyboard. Write one page statement to examine this problem.

  Creating loop to find number of items bought based on price

Make a block using a loop that will find the number of items that can be bought based on the price of the item and the total amount available to spend.

  Write function that produces a stream prime numbers

Write a function that produces a stream of positive prime numbers . Use that stream to create a list of the product of all pairs of consecutive prime numbers up to a given value.

  Define switch-case function in javascript

I'm making a game where the user should combine the sound of a bird with the correct picture. In my webpage 20 different birds are represented. While pressing a button the game starts and a random birdsong will sound. Clicking the right bird will ..

  Explain is there a downside to using prototypes

Is there a downside to utilizing prototypes? Prototypes can show to user the look and feel of application but frquently the more sophisticated tools (like data entry verification) have not been implemented.

  Differences between pass by reference and pass by value

Discuss the advantages and disadvantages of using pass by reference versus pass by value in an embedded C program.

  Write a program that display amount of discount on item

Write a program that asks the user to enter number of packages purchased. Program must then display amount of the discount (if any) and total amount of the purchase after the discount.

  Sequence of statements to find first comma in string line

Write a sequence of statements that finds first comma in String line , and assigns to variable clause portion of line up to, but not including the comma.

  When the program starts the user is asked to seed the

write a program that lets the user play the game of rock paper scissors against the computer. the program should work

  Constructors need to be declared for each class.

Hi, I need helping figuring out the following questions. I need to identify the following statements as either true or false. If an answer is true, I need to explain why and, where appropriate, provide an example. If the answer is false, I also ne..

  Describe the contents of text box after button is clicked

Describe the contents of the text box after the button is clicked

  Include a pseudo code, flowcharts making complete solution

Your final document should contain a "hierarchy chart" of phases, flowcharts, pseudo code, data dictionary, and seven UML diagrams as developed in Visio and Word. Your document should also contain a paragraph narrative on how each diagram relates ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd