Wk04_Selection_Questions_ASSIGNMENT - COMP100 Programming...

Info icon This preview shows pages 1–2. Sign up to view the full content.

COMP100 Programming Fundamentals Week 4 Lab Exercise using the if statement Question 3-7 is due at the beginning of next class (just demonstration) 1. Write a console-based program that prompts the user for an hourly pay rate. If the value entered is less than $7.50, display an error message 2. Write a console-based program that prompts a user for an hourly pay rate. If the value entered is less than $7.50 or greater than $49.99, display an error message; otherwise, display a message indicating that the rate is okay. 3. If money is left in a particular bank for more than 5 years, the interest rate given by the bank is 7.5%, else the interest rate is 5.4%. Write a program that prompt the user for the number of years that the money was left in the bank and display the appropriate interest rate depending on the value input. How many runs should you make to very that it works correctly? 4. Write a console-based program that accepts a user’s message and determines whether it is short enough for a social networking service that does not accept messages of more than 140 characters. [Hint: if the user’s input is assigned to the variable message then message.Length with give the number of characters in the input] 5. Write an application that asks a user to enter an IQ score. If the score is a number less than 0 or greater than 200, issue an error message; otherwise, issue an “above average”, “average”, or “below average” message for scores over, at, or under 100, respectively 6. Write a console-based program that prompts the user for an hourly pay rate and hours worked. Compute gross pay (hours times pay rate), withholding tax, and net pay (gross pay minus withholding tax). Withholding tax is computed as a percentage of gross pay based on the following: Gross Pay
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '15
  • Allan Randall
  • Randomness, Rock-paper-scissors, console-based program, console-based

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern