80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
Unit it designing structured programs (a) Gross pay = Hours worked t.docx
1. Unit it designing structured programs (a) Gross pay = Hours
worked times Rate (b) F.L.C.A. (Social Security and Medicare
taxes) = 7.65% of Gross pay (c) Net pay = Gross pay - F.I.C.A.
write a program to print out payroll information for each
employee. The problem definition is shown in Figure 7.4.
Interactive processing, For each customer loan approved at
Dollars-And-Sense Bank do play a line indicating the monthly
payment for that customer. Enter the following information
from the keyboard: CUSTOMER NAME: AMT OF LOAN
(PRINCIPAL): YEARLY INTEREST RATE: LENGTH OF
LOAN (IN YEARS): See the example on the next page.
Problem definition for programming Assignment 2. what are
the monthly payments on a twenty-year loan of $20, 000 at
12%? P = 20000 R = .12 N = 20 years Monthly payment =
20000 * (.12/12) - (20000 * (.12/12)/(1 - (1.01)^240)) = 20000
* (.01) - (20000 * .01/(1 - (1.01)^240)) = 200 - (-20.22) =
220.22 Round monthly payments to the nearest penny. Design
the interactive screen displays yourself.
Solution
Program:
import java.util.Scanner;
class payroll{
{
public static void main(string[] args)
{
Scanner input=new Scanner(System.in);
2. system.out.println("enter employee name:");
string employee=input.next();
system.out.println("Enter number of hours worked:");
double hours=input.nextDouble();
system.out.println("enter hourly pay rate:");
double pay=input.nextDouble();
double gross_pay=pay*hours;
system.out.println("enter federal tax withholding rate:");
double fedtax=input.nextDouble();
double fedtaxr=fedtax*0.20;
system.out.println("enter social security and medicine tax :");
double social_security=input.nextDouble();
double social_security=statetax*0.20;
double deductions=fedtaxer;
double total _pay=gross_pay - deductions;
system.out.println("employee name:"+employee);
system.out.println("hours worked:"+hours);
system.out.println("enter payrate:"+pay);
system.out.println("enter gross pay:"+gross_pay);
system.out.println("Deductions");
system.out.println("t Federal withholding(20.0%):"+fedtaxr);
system.out.println("t State withholding (9.0%)"+statetaxr);
system.out.println("t Total deductions: "+deduction);
system.out.println("Total pay:" + total_pay);