Ask Question
Yesterday, 13:09

2.3 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Use 35 hours and a rate of 2.75 per hour to test the program (the pay should be 96.25). You should use input to read a string and float () to convert the string to a number. Do not worry about error checking or bad user data.

+3
Answers (1)
  1. Yesterday, 15:22
    0
    The programming language is not stated; However this program will be written using Python programming language

    Comments are not used; See Explanation Section for line by line explanation of the code

    hours = float (input ("Hours: "))

    rate = float (input ("Rate per hour: "))

    pay = hours * rate

    print (pay)

    Explanation:

    The first line of the code prompts the user for hour.

    The input is converted from string to float

    hours = float (input ("Hours: "))

    The next line prompts the user for hour.

    It also converts input from string to float

    rate = float (input ("Rate per hour: "))

    Pay is calculated by multiplying hours by rate; This is implemented using the next line

    pay = hours * rate

    The calculated value of pay is displayed using the next line

    print (pay)

    When the program is tested by the given parameters in the question

    hours = 35

    rate = 2.75

    The printed value of pay is 96.25
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “2.3 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Use 35 hours and a rate of 2.75 per ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers