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
Zinaida [17]
3 years ago
9

Write a program to calculate the total salary of the employees in an office. The program will first prompt the user to enter the

number of employees. For each employees, the program asks the user to enter the pay rate and hours worked.

Computers and Technology
2 answers:
seraphim [82]3 years ago
8 0

Answer:

# the user is prompt to enter the number of employees

number_of_employees = int(input("Enter number of employee: "))

# the total_salary is initialized to 0

total_salary = 0

# for loop that loop through the number of employees

# and calculate the salary for each by multiplying the rate & hour

for each_employee in range(number_of_employees):

   employee_hour = int(input("Enter your worked hour: "))

   employee_rate = int(input("Enter your rate: "))

   employee_salary = employee_hour * employee_rate

   # the total salary is gotten by adding it to employee salary

   total_salary += employee_salary

   

# The total salary is displayed.

print("The total salary for the entire employee is: $", total_salary, sep="")    

Explanation:

The program is written in Python and is well commented. An image for the program output when it is executed is attached.

raketka [301]3 years ago
6 0

Answer:

import java.util.Scanner;

public class Salary

{

public static void main(String[] args) {

   

    int numberOfEmployees;

    double payRate, numberOfHours, totalPay = 0;

       Scanner input1 = new Scanner(System.in);

       Scanner input2 = new Scanner(System.in);

       System.out.print("Enter the number of employees: ");

       numberOfEmployees = input1.nextInt();

       

       for(int i=1; i<=numberOfEmployees; i++) {

           System.out.print("Enter the pay rate for employee " + i + ": ");

           payRate = input2.nextDouble();

           System.out.print("Enter the number of hours worked: ");

           numberOfHours = input2.nextDouble();

           

           totalPay += (payRate * numberOfHours);

       }

       

       System.out.println("Total payment is: "+ totalPay);

}

}

Explanation:

- Declare the variables

- Ask the user the for the number of employees

- Inside the for loop, ask the user for pay rate and hours worked for each employee

- Calculate the total pay

- <u>Outside of the loop</u>, print the total pay

You might be interested in
​Lara is the chief editor of "Laughter and Life," an online magazine. Lara has assigned Jenny the task of redesigning the magazi
Zarrin [17]

Answer:

The "A" option is correct.

Explanation:

For CSS flexbox layout, the property "align-content" requires that the space in the flexbox is more than enough to show the items. In this case, to distribute evenly the items and show the first and last items aligned with the start and end of the main axis, the only suitable option is "space-between". This option leaves no space at the start or at the end of the flexbox, distributing the remaining space between the elements into the flexbox.

7 0
3 years ago
Có n chiếc kẹo và m em bé. Hãy viết chương trình nhập vào hai số nguyên dương n, m và kiểm tra n chiếc kẹo có chia đều được cho
sleet_krkn [62]

uy ako ba yung pilipino dito hi nga kau

5 0
2 years ago
2) [13 points] You’ve been hired by Banker Bisons to write a C++ console application that determines the number of months to rep
Paha777 [63]

Answer:

Check the explanation

Explanation:

CODE:

#include <iostream>

#include <iomanip>

using namespace std;

double getLoanAmount() { // functions as per asked in question

double loan;

while(true){ // while loop is used to re prompt

cout << "Enter the car loan amount ($2,500-7,500): ";

cin >> loan;

if (loan>=2500 && loan <= 7500){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< loan << " is an invalid loan amount." << endl;

}

}

return loan;

}

double getMonthlyPayment(){ // functions as per asked in question

double monthpay;

while(true){ // while loop is used to re prompt

cout << "Enter the monthly payment ($50-750): ";

cin >> monthpay;

if (monthpay>=50 && monthpay <= 750){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: $"<< monthpay << " is an invalid monthly payment." << endl;

}

}

return monthpay;

}

double getInterestRate(){ // functions as per asked in question

double rate;

while(true){ // while loop is used to re prompt

cout << "Enter the annual interest rate (1-6%): ";

cin >> rate;

if (rate>=1 && rate <= 6){ // if the condition is fulfilled then

break; // break statement is use to come out of while loop

}

else{ // else error message is printed

cout << "Error: "<< rate << "% is an invalid annual interest rate." << endl;

}

}

return rate;

}

int main() {

cout << setprecision(2) << fixed; // to print with 2 decimal places

int month = 0; // initializing month

// calling functions and storing the returned value

double balance= getLoanAmount();

double payment= getMonthlyPayment();

double rate= getInterestRate();

rate = rate /12 /100; // as per question

// printing as per required in question

cout << "Month Balance($) Payment($) Interest($) Principal($)"<< endl;

while(balance>0){ // while the balance is more than zero

month = month + 1; // counting Months

// calculations as per questions

double interest = balance * rate;

double principal = payment - interest;

balance = balance - principal;

// printing required info with proper spacing

cout <<" "<< month;

cout <<" "<< balance;

cout <<" "<< payment;

cout <<" "<< interest;

cout <<" "<< principal << endl;

}

cout << "Months to repay loan: " << month << endl; // displaying month

cout << "End of Banker Bisons";

Kindly check the output in the attached image below.

5 0
3 years ago
Reading is the process of transferring data, instructions, and information from memory to a storage medium.
maksim [4K]
True, the computer will read from, say, a blu-ray and then transfer it to your RAM to before writing it to your hard drive and then, through the various other wonders of computers, it can be displayed on your monitor.
8 0
3 years ago
Money left over after the bills are paid is referred to as
sveta [45]
Change is what is left over 

ex. the cashier tells you "here is your leftover change sir/ma'am "<span />
3 0
3 years ago
Read 2 more answers
Other questions:
  • Imagine that you are an independent filmmaker making a feature-length narrative film in the United States, with a variety of bot
    11·2 answers
  • What is the windows server 2012 r2 feature that enables you to maintain previous versions of files on a server, so that if users
    10·1 answer
  • Write a program that asks the user for three strings. Then, print out whether the first string concatenated to the second string
    8·1 answer
  • ____ is the code of acceptable behaviors users should follow while on the internet; that is, it is the conduct expected of indiv
    10·1 answer
  • What is hyper transport
    10·1 answer
  • When an interrogator speaks highly about how a crime was committed, hoping to get the suspect to brag about his or her involveme
    7·2 answers
  • What laptops can you get for 2500$ and should mostly using Microsoft applications.
    14·2 answers
  • What cannot be performed using windows task manager
    10·1 answer
  • Your task is to identify three or more ways that big data is being collected on a regular basis, including one data collection m
    9·1 answer
  • Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!