create a Java program that prompt the user to enter a number of hours, wages, over time factor, then your program should calculate the employee total wages. Make sure your program can calculate the over time and regular wages if number of hours are great than 40 hours. Use 1.5 for over time factor. Make sure your Java code has comments showing declarations and description of your variables.

Answers

Answer 1
Answer:

Answer:

The program to the given question as follows:

Program:

import java.util.*; //import package for user input.

public class Main //defining class Main

{

public static void main(String[] as) //defining main method

{

final double over_time_factor = 1.5; //define final variable

double number_Of_hours,wages,total_Wages=0; //defining variables  

System.out.println("Enter hours and wages rate:"); //print message

Scanner obc = new Scanner(System.in); //creating Scanner class object for user input

number_Of_hours = obc.nextDouble(); //taking input

wages = obc.nextDouble(); //taking input

if(number_Of_hours>40) //check condition if number_Of_hours greter then 40

{

total_Wages=40*wages+(number_Of_hours-40)*wages*over_time_factor; //calculate value

}

else //else part

{

total_Wages = number_Of_hours*wages; //calculate total_Wages

}

System.out.println("Total Wages: $"+total_Wages); //print value

}

}

Output:

Enter hours and wages rate:

12

3

Total Wages: $36.0

Explanation:

In the above java program, the package is first imported into the user input and then the class is defined and inside this, the main method is defined, that defines a double type final variable "over_time_factor" is defined that holds a value "1.5", Then double type variable is defined that are " number_Of_hours, wages, and total_Wages", in which first two variables are used for taking input from the user and the third variable is used to calculate their values. After taken input from the user, the conditional statement is used that can be defined as follows:

  • The if block, checks the variable "number_Of_hours" value is greater than 40 it will calculate over_time_factor value that is held by total_Wages variable.  
  • In else block, it will multiply the user input value that is store in total_Wages variable.  
  • At the end of the conditional statement, the print function is used that prints total_Wages variable value.  


Related Questions

This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)while (arrowHeadWidth <= arrowBaseWidth) {// Prompt user for a valid arrow head value}Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:Enter arrow base height:5Enter arrow base width:2Enter arrow head width:4********************This is what I have:import java.util.Scanner;public class DrawHalfArrow{public static void main(String[] args){Scanner scnr = new Scanner(System.in);int arrowBaseHeight = 0;int arrowBaseWidth = 0;int arrowHeadWidth = 0;System.out.println("Enter arrow base height:");arrowBaseHeight = scnr.nextInt();System.out.println("Enter arrow base width:");arrowBaseWidth = scnr.nextInt();while (arrowHeadWidth >= arrowBaseWidth){System.out.println("Enter arrow head width:");arrowHeadWidth = scnr.nextInt();} // Draw arrow base (height = 3, width = 2)for(int i=0; i < arrowBaseHeight; ++i){for(int j=0; j < arrowBaseWidth; ++j){System.out.print("*");}System.out.println();}// Draw arrow head (width = 4)for(int i=0; i < arrowHeadWidth; ++i){for(int j=0; j < arrowHeadWidth-i; ++j){System.out.print("*");}System.out.println();}return;}}
Select the true statement(s) regarding a virtual circuit. a. both analog and digital networks take advantage of the virtual circuit concept b. virtual circuits require the assignment of dedicated physical links during network connection c. regarding the efficient use of physical links, virtual circuits are more efficient than analog circuits d. both a and b are true statements"
A database is composed of several parts known as database ____
Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is April 11, the output is: spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is invalid, the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19
As sensory input ________, our ability to detect changes in input or intensity ________.

A vowel word is a word that contains every vowel. Some examples of vowel words are sequoia, facetious, and dialogue. Determine if a word input by the user is a vowel word.

Answers

Answer:

vowels = ("a", "e", "i", "o", "u")

word = input("Enter a word: ")

is_all = True

for c in vowels:

   if c not in word:

       is_all = False

if is_all == True:

   print(word + " is a vowel word.")

else:

   print(word + " is not a vowel word.")

Explanation:

Initialize a tuple, vowels, containing every vowel

Ask the user to enter a word

Initially, set the is_all as True. This will be used to check, if every vowel is in word or not.

Create a for loop that iterates through the vowels. Inside the loop, check if each vowel is in the word or not. If one of the vowel is not in the vowels, set the is_all as False.

When the loop is done, check the is_all. If it is True, the word is a vowel word. Otherwise, it is not a vowel word.

. How are returnspredicted in modern microprocessors?

Answers

Answer:

Return are predicted in the modern microprocessor as, branch predictor is the modern method for the processor for the prediction. The basic function of the branch predictor is improving in the pipeline instruction. It is basically the important part for implement the execution and the pipe lining. And the return predicted uses the call by reference technique for the data in instruction.

A constructor (check all that apply): Group of answer choices will always result in a run time error and program crash if it fails to test a parameter's value for validity before assigning the parameter's value to member. This will happen the first time we run a program, and alert us to the fact that there is a problem. must use mutators to initialize class data. must use assignment statements to initialize class data. may use assignment statements to initialize class data. may use mutators to initialize class data. will receive a compiler error if it fails to test a parameter's value for validity before assigning the parameter's value to member.

Answers

Answer:

Must use mutators to initialize class data.

May use assignment statements to initialize class data.

Explanation:

These are the two characteristics that are present in constructors. A constructor is an instance method of a class or structure that creates an object of the class to which it belongs. This is mostly used in object-oriented programming. These constructors usually have the same name as the actual class, and can be used in order to set the values of the members of an object.

Feature of word processing​

Answers

Answer:

the word processing

Explanation:

the word is a good word

Nice word i like processing word feature too i think words are cool

Consider a demand-paging system in which processes are performing sequential data accesses with the following time-measured utilizations: CPU utilization 20%
Paging disk 98%
Other I/O devices 10%

For each of the following, indicate yes or no to say whether or not it will (or is likely to) improve CPU utilization:

a. Install a faster CPU
b. Install a bigger paging disk
c. Increase the degree of multiprogramming
d. Decrease the degree of multiprogramming
e. Install more main memory
f. Install a faster hard disk
g. Increase the page size

Answers

Answer:

a. Install a faster CPU - No

b. Install a bigger paging disk - No

c. Increase the degree of multiprogramming - No

d. Decrease the degree of multiprogramming - Yes

e. Install more main memory - Yes

f. Install a faster hard disk - Yes

g. Increase the page size - Yes

Explanation:

a. Install a faster CPU No.

Installing a faster CPU will not improve CPU utilization too much because the CPU utilization is low (20%) and the utilization of the paging disk is very high (98%), we can see that the system has lack of free memory.

b. Install a bigger paging disk No.

Installing a bigger paging disk doesn't improve the CPU utilization because the system has lack of free memory.

c. Increase the degree of multiprogramming No.

If the level of multiprogramming is increased more processes would have to be swapped in and out of the memory with a higher chance of page fault much frequently and the CPU utilization would reduce.

d. Decrease the degree of multiprogramming Yes.

If the level of multiprogramming is reduced less processes would have to be swapped in and out of memory, reducing the chance of page fault and the CPU utilization would improve.

e. Install more main memory

This is likely to improve CPU utilization as more pages can remain resident and not require paging to or from the disks.

f. Install a faster hard disk

With a faster hard disk, the CPU will get more data more quickly and this will lead to faster response and more throughput to the disks. With a faster hard disk, the disk is not a bottleneck to utilization.

g. Increase the page size

Increase the page size will likely degrade the performance, because the internal fragmentation will be worse, the utilization of main memory will be low, more processes will not be able to fit into main memory, and the system will have to spend more time in swapping. So this is as likely to decrease utilization as it is to increase it.

Which of the following people was a member of FFA?O Kenny Chesney
O Tim McGraw
O Alan Jackson
O Billy Currington

Answers

Answer: Tim McGraw

Explanation:

The National FFA Organization is a youth organization that originally aimed to encourage the youth to venture into agriculture by offering agriculture education to youth in high schools and middle schools. In recent years they started offering education in other areas such as business and technology.

The FFA is quite famous and has had and still has a lot of members. It is of no surprise therefore that some of their alumni are now stars. Famous Country musician Tim McGraw is one such alumni and he was a member of the FFA in his hometown of Start, Louisiana.

Other stars who were part of the FFA include; Taylor Swift and Sterling Martin.