Click here to Skip to main content
15,876,879 members
Home / Discussions / Java
   

Java

 
AnswerRe: Switch from VB.Net to Java Pin
Dave Kreskowiak4-Feb-22 6:13
mveDave Kreskowiak4-Feb-22 6:13 
GeneralRe: Switch from VB.Net to Java Pin
Kanel Roath5-Feb-22 2:45
Kanel Roath5-Feb-22 2:45 
GeneralRe: Switch from VB.Net to Java Pin
Dave Kreskowiak5-Feb-22 5:34
mveDave Kreskowiak5-Feb-22 5:34 
AnswerRe: Switch from VB.Net to Java Pin
Gerry Schmitz5-Feb-22 6:04
mveGerry Schmitz5-Feb-22 6:04 
GeneralRe: Switch from VB.Net to Java Pin
trønderen5-Feb-22 8:17
trønderen5-Feb-22 8:17 
GeneralRe: Switch from VB.Net to Java Pin
Gerry Schmitz5-Feb-22 18:27
mveGerry Schmitz5-Feb-22 18:27 
AnswerRe: Switch from VB.Net to Java Pin
jschell17-Feb-22 11:33
jschell17-Feb-22 11:33 
QuestionJAVA Pin
Ku Hazwan29-Jan-22 16:15
Ku Hazwan29-Jan-22 16:15 
Instructions:
1. Provide the flowchart, complete code and sample output for all of the questions.

 A medium sized company has two types of 
employees which are hourly workers and commission workers. Each type of employee 
has its own pay code:

Pay Code    Employee Type
   1         Hourly Worker
   2        Commission Worker

The hourly worker is paid RM50 per hour for the first 40 hours he/she works and 
"time-and-a-half" (1.5 times the hourly rate of RM50) for each of the hours above 40 
hours (overtime hours). The commission worker receives RM500 plus 5.5% of their 
weekly sales (e.g. 5.5% of RM1000 is RM55).

You are asked by the company to write a Java program that can determine the salary 
for both employee types. The program must implement TWO (2) methods, namely 
calculatePayHourlyWorker() and calculatePayCommWorker() to perform 
the salary calculations for the respective types of employees. Each of the methods 
displays the calculated salary amount.

The input for the program is the pay code and the appropriate information needed to 
calculate each employee’s salary based on the pay code. If the pay code entered is a 
negative value, the program will terminate. If it is invalid (other than 1 or 2), display 
an appropriate error message. The output is the calculated salary, which must be 
printed to TWO (2) decimal places.

The format of the input and output is as follows:

The format of the input and output is as follows:

Enter pay code: 1
Enter the number of hours worked: 40
Salary is RM2000.00
Enter pay code: 1
Enter the number of hours worked: 50

Salary is RM2750.00
Enter pay code: 2
Enter the amount of weekly sales: 1000
Salary is RM555.00
Enter pay code: 3
Invalid product code!
Enter pay code: -1

Note: The underline texts are the input to the program
a) Complete the program main() method based on the given description.
b) Complete the calculatePayHourlyWorker() method.
c) Complete the calculatePayCommWorker() method.
You can use this as a guideline:

import java.util.Scanner;
public class SalaryApp {
 static Scanner read = new Scanner(System.in);
 static int hours;
 static double salary;
 
 public static void main(String[] args) {
 int paycode;
 
 //TODO: add your code here
 
 
 }
 
 //complete the calculatePayHourlyWorker() method
 public static void calculatePayHourlyWorker() {
 
 }
 
 //complete the calculatePayCommWorker() method
 public static void calculatePayCommWorker() {
 double sales = 0;
 } 
}

AnswerRe: JAVA Pin
Dave Kreskowiak29-Jan-22 18:40
mveDave Kreskowiak29-Jan-22 18:40 
AnswerRe: JAVA Pin
jschell30-Jan-22 7:11
jschell30-Jan-22 7:11 
GeneralRe: JAVA Pin
Richard MacCutchan30-Jan-22 22:35
mveRichard MacCutchan30-Jan-22 22:35 
GeneralRe: JAVA Pin
jschell17-Feb-22 11:34
jschell17-Feb-22 11:34 
QuestionHow TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202226-Jan-22 22:23
Tauqeer Ahmad 202226-Jan-22 22:23 
AnswerRe: How TO run the jar file in teradata ? Pin
OriginalGriff26-Jan-22 23:17
mveOriginalGriff26-Jan-22 23:17 
GeneralRe: How TO run the jar file in teradata ? Pin
Slacker00727-Jan-22 2:21
professionalSlacker00727-Jan-22 2:21 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202227-Jan-22 3:59
Tauqeer Ahmad 202227-Jan-22 3:59 
AnswerRe: How TO run the jar file in teradata ? Pin
jschell30-Jan-22 7:18
jschell30-Jan-22 7:18 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202230-Jan-22 23:39
Tauqeer Ahmad 202230-Jan-22 23:39 
QuestionLooping Array and Satisfying multiple conditions-Support Pin
Member 1551308825-Jan-22 22:01
Member 1551308825-Jan-22 22:01 
AnswerRe: Looping Array and Satisfying multiple conditions-Support Pin
Afzaal Ahmad Zeeshan5-Feb-22 11:40
professionalAfzaal Ahmad Zeeshan5-Feb-22 11:40 
QuestionPdf em java (PDF in Java) Pin
Daniel Carvalho 202221-Jan-22 1:54
Daniel Carvalho 202221-Jan-22 1:54 
AnswerRe: Pdf em java (PDF in Java) Pin
OriginalGriff21-Jan-22 2:00
mveOriginalGriff21-Jan-22 2:00 
GeneralRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202224-Jan-22 5:53
Daniel Carvalho 202224-Jan-22 5:53 
QuestionRe: Pdf em java (PDF in Java) Pin
David Crow24-Jan-22 6:06
David Crow24-Jan-22 6:06 
AnswerRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202225-Jan-22 4:19
Daniel Carvalho 202225-Jan-22 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.