Ask Question
3 October, 12:23

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.

+1
Answers (1)
  1. 3 October, 12:44
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers