Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Homework 1 (Elementary Programming)

1. Tips.java: (Financial application: calculating tips) Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user enters 10 for         subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.

2. Payroll.java: Write a program that reads the following information and prints a payroll        statement: Employee's name (e.g., Smith) Number of hours worked in a week (e.g., 10) Hourly pay rate (e.g., 15.75) Federal tax withholding rate (e.g., 20%) State tax withholding rate (e.g.,   9%). The program prints the gross and net pay for the employee and payed taxes.

3. ISBN.java: International Standard Book Number (ISBN) consists of 10 digits                       d1d2d3d4d5d6d7d8d9d10. The last digit d10 is a checksum, which is calculated from the other nine digits using the following formula:

(d1 x 1 + d2 x 2 + d3 x 3+ d4 x 4 + d5 x 5 + d6 x 6 + d7 x 7 + d8 x 8 + d9 x 9) % 11

 

If the checksum is 10, the last digit is denoted X according to the ISBN convention. Write a         program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. For example, if you enter          013601267, the program should display 0136012671.

OPTIONAL: If the user omits the leading zeros, the program should continue by adding the   leading zeros. For example, if you enter 12345, the program should display "The correct ISBN number is 0000123455".

4. ValidTriangle.java: Write a program that reads three edges for a triangle and determines      whether the input is valid. The input is valid if the sum of any two edges is greater than the third edge.