What's new

Comment for Chegg answers

Status
Not open for further replies.
1606018025249.png
1606018032469.png
 

Attachments

import java.util.Scanner;


public class Paycheck {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

System.out.print("Enter your monthly salary: ");
double salary = sc.nextFloat();
sc.close();

double federalTax = salary*.15;
double stateTax = salary*0.035;
double socialSecurityTax = salary*0.0575;
double medicareTax = salary*0.0275;
double pensionPlan = salary*0.05;
double healthInsurance = 75.00;

double totalTax = federalTax + stateTax + socialSecurityTax + medicareTax;

double payCheck = salary - (totalTax + pensionPlan + healthInsurance);

System.out.println("Monthlly paycheck: $" + payCheck);
System.out.println("Total deduction: $" + (totalTax + pensionPlan + healthInsurance));
System.out.println("Federal Tax: $" + federalTax);
System.out.println("State Tax: $" + stateTax);
System.out.println("Social Security Tax: $" + socialSecurityTax);
System.out.println("Medicare/Medicaid Tax: $" + medicareTax);
System.out.println("Pension Plan: $" + pensionPlan);
System.out.println("Health Insurance: $" + healthInsurance);

}

}

Sample run

Enter your monthly salary: 10000
Monthlly paycheck: $6725.0
Total deduction: $3275.0
Federal Tax: $1500.0
State Tax: $350.00000000000006
Social Security Tax: $575.0
Medicare/Medicaid Tax: $275.0
Pension Plan: $500.0
Health Insurance: $75.0
 
import java.util.*;
public class Main
{
public static void main(String[] args) {
double witholdingTax,sssContribution,medicare,pag,netpay;
Scanner input=new Scanner(System.in);
System.out.print("Enter employee name:\t");
String name=input.nextLine();
System.out.print("Enter Gross Pay:\t");
double grosspay=input.nextFloat();

witholdingTax=grosspay*15/100;
sssContribution=grosspay*3.63/100;
medicare=grosspay*1.25/100;
pag=100.0;
netpay=grosspay-witholdingTax-sssContribution-medicare-pag;

System.out.println("Employee Name:\t\t"+name);
System.out.println("Gross Pay:\t\t"+grosspay);
System.out.println("-----------------------------");
System.out.println("Deductions\t\tAmount");
System.out.println("Witholding Tax:\t\t"+witholdingTax);
System.out.println("SSS Contribution:\t"+sssContribution);
System.out.println("Medicare:\t\t"+medicare);
System.out.println("Pagibag Contribution:\t"+pag);
System.out.println("-----------------------------");
System.out.println("Net Pay:\t\t"+netpay);
}
}
 
Resolution= Vr/(2^n -1)
0.04= Vr/(2^7 -1)
Vr= 127*0.04= 5.08V

a. 1001011 =(75)10

equivalent voltage = 75*0.04 = 3.00V

b. 0101101 =(45)10

equivalent voltage = 45*0.04 = 1.80V

2)

Resolution= Vr/(2^n-1 )

Resolution=1.27/(2^8-1 )

Resolution=1.27/(255 )

Resolution=0.00498 V

Accuracy = Resolution/2 = 0.00249 V

3)For a 12 bit linear PCM code with a resolution of 0.02V

so

a. 100000000001 = (2049)10

equivalentVoltage = 2049 *0.02= 40.98 V

b. 000000000000= (0)10

equivalentVoltage = 0 *0.02=0 V

c. 110000000000 = (3072)10

equivalentVoltage = 3072 *0.02= 61.44 V

d. 010000000000=(1024)10

equivalentVoltage = 1024*0.02= 20.48 V

e. 101000000001 = (2560)10

equivalentVoltage =2560 *0.02= 51.20 V

f. 101010101010 =(2720)10

equivalentVoltage = 2720*0.02= 54.40 V
 
Status
Not open for further replies.

Similar threads

Back
Top