1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nataly [62]
4 years ago
12

create a Java program that prompt the user to enter a number of hours, wages, over time factor, then your program should calcula

te 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.
Computers and Technology
1 answer:
prohojiy [21]4 years ago
3 0

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.  

You might be interested in
_ is the use of a collection of computers, often owned by many people or different organizations, to work in a coordinated manne
ddd [48]

Answer:

"Grid computing" is the correct answer for the above question.

Explanation:

  • Grid computing is a process in which many computers are participating to solve a single problem. This type of process is distributed multiple computers to perform a different type of task.
  • If there is large problem and if many computers solve that problem, then that problem is solved easily within a few minutes.
  • This is because many computers are working for that problem.
  • The above question asked about that process in which many computers are working to solve a single problem. This processor is known as "Grid Computing".
8 0
3 years ago
PLEASE HELP!!!
anygoal [31]

Answer:

you need to properly indent it

Explanation:

align your codes

5 0
3 years ago
1. The________  member function moves the read position of a file.
emmasim [6.3K]

Answer:

Answers explained with appropriate comments

Explanation:

1. seekp()   //the seekp sets the position where the next character is to be   //inserted into the output stream.

2. fstream  //fstream is used for input and output for files

//just like iostream for input and output data

3. tellp();  //tellp returns the "put" or write position of the file.

4. ios::ate  //ate meaning at the end, sets the file output at the file end

5. binary files  //binary files only store 0s and 1s

6. seekg()  //seekg is used to move write position of the file

7. put  //this is used to "put" or set records or arrays to a single file

8. std::ws , skips //the std::ws is used to discard leading whitespace from an //input stream

9. peek //this looks at the next character in the input sequence

10. get, peak //get and peek do not skip leading whitespace characters

8 0
3 years ago
Develop an algorithm and write a C++ program that finds the number of occurrences of a specified character in the string; make s
nirvana33 [79]

Answer:

The algorithm is as follows:

1. Input sentence

2. Input character

3. Length = len(sentence)

4. count = 0

5. For i = 0 to Length-1

 5.1 If sentence[i] == character

    5.1.1 count++

6. Print count

7. Stop

The program in C++ is as follows:

#include <iostream>

#include <string.h>

using namespace std;

int main(){

char str[100];   char chr;

cin.getline(str, 100);

cin>>chr;

int count = 0;

for (int i=0;i<strlen(str);i++){

 if (str[i] == chr){

  count++;} }

cout << count;

return 0;}

Explanation:

I will provide explanation for the c++ program. The explanation can also be extended to the algorithm

This declares the string and the character

char str[100];   char chr;

This gets input for the string variable

cin.getline(str, 100);

This gets input for the character variable

cin>>chr;

This initializes count to 0

int count = 0;

This iterates through the characters of the string

for (int i=0;i<strlen(str);i++){

If the current character equals the search character, count is incremented by 1

 if (str[i] == chr){  count++;} }

This prints the count

cout << count;

8 0
3 years ago
EDVAC stands for? on which theory it is made on?
almond37 [142]

Answer:EDVAC (Electronic Discrete Variable Automatic Computer)

foi um dos primeiros computadores eletrônicos. Ao contrário do ENIAC que operava com base em codificação decimal, o EDVAC foi projetado para utilizar códigos binários e manter os programas armazenados na memória, respeitando a arquitetura de vo n Neumann.

Explanation:

6 0
3 years ago
Other questions:
  • How does scarcity affect what gets produced
    5·1 answer
  • Where may an operating system reside in a mobile device?
    5·1 answer
  • Write a multi-paragraph Informational essay about a current event in the news. You can develop your topic using
    8·2 answers
  • Read the following scenario and decide who, if anyone, is committing sexual harassment:
    13·2 answers
  • What does psychologist Edward Spector mean when he says “ We have an entire generation of guinea pigs in an experiment”?
    14·1 answer
  • The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours; any hours worked be
    11·1 answer
  • Which of the following is an example of joint problem solving?
    12·1 answer
  • My brainly isnt working it isnt showing and answers wats going on? wat do i do
    14·2 answers
  • Which of the following should you press to insert a non-
    8·2 answers
  • Which programming paradigm focuses on abstraction to the level of math and the elimination of side-effects and state based progr
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!