Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

import java.util.*;
public class Main0 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int totalEmployee = 10;
String [] fname = new String[totalEmployee];
String [] mname = new String[totalEmployee];
String [] lname = new String[totalEmployee];
int [] idNum = new int[totalEmployee];
// Hours Worked Must be Between 0 and 60 Hours
int [] workHour = new int[totalEmployee];
// Rate per Hour Must be Between 15ドル.00 and 35ドル.00
int [] ratePerHour = new int[totalEmployee];

// add Data in the array

for (int i=0; i<totalEmployee; i++){
// First Name Input
System.out.println("Enter First Name");
fname[i] = sc.next();
// Middle Name Input
System.out.println("Enter Middle Name");
mname[i] = sc.next();
// Last Name Input
System.out.println("Enter Last Name");
lname[i] = sc.next();
// Id Number Input
System.out.println("Enter Id number");
idNum[i] = sc.nextInt();
// Hours Worked Input
System.out.println("Enter Hours worked");
workHour[i] = sc.nextInt();
// Rate Per Hour Input
System.out.println("Enter Rate Per Hour");
ratePerHour[i] = sc.nextInt();
}
// State Tax Percentage
int state_tax_p = 7;
// Fed Tax Percentage
int fed_tax_p = 15;
// Gross Array Created
double [] gross = new double[totalEmployee];
for (int i=0; i<totalEmployee; i++){
if(workHour[i] > 0){
if(ratePerHour[i] >= 15 && ratePerHour[i] <= 35){
if(workHour[i] < 40){
gross[i] = workHour[i] * ratePerHour[i];
}
else{
gross[i] = (40 * ratePerHour[i] + (workHour[i] - 40) * ratePerHour[i] * 1.5);
}
}
else{
System.out.println("Please Enter Your Number Between 15 to 35");
}
}
else{
System.out.println("Please Enter Greater Number");
}
}
// Stored State Tax, Fed Tax and Net in the array for 10 Employee

double [] state_tax = new double[totalEmployee];
double [] fed_tax = new double[totalEmployee];
double [] net = new double[totalEmployee];
for(int i=0; i<totalEmployee; i++){
state_tax[i] = gross[i] * state_tax_p;
fed_tax[i] = gross[i] * fed_tax_p;
net[i] = gross[i] - (state_tax[i] + fed_tax[i]);
}

// Print All The Data With Table Format
System.out.printf("%-15s %-15s %-15s %-15s %-15s %-15s %-15s %-15s %-15s\n", "Last Name", "First Name", "MI Id", "Rate Per Hour", "Hours Worked", "State Tax", "Fed tax", "Gross", "Net");
for(int i=0; i<totalEmployee; i++) {
System.out.printf("%-15s %-15s %-15d %-15d %-15d %-15f %-15f %-15f %-15f\n", lname[i], fname[i], idNum[i], ratePerHour[i], workHour[i], state_tax[i], fed_tax[i], gross[i], net[i]);
}



}
}

Pseudo Code

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Computer Networking: A Top-Down Approach (7th Edi...
    Computer Engineering
    ISBN:9780133594140
    Author:James Kurose, Keith Ross
    Publisher:PEARSON
    Text book image
    Computer Organization and Design MIPS Edition, Fi...
    Computer Engineering
    ISBN:9780124077263
    Author:David A. Patterson, John L. Hennessy
    Publisher:Elsevier Science
    Text book image
    Network+ Guide to Networks (MindTap Course List)
    Computer Engineering
    ISBN:9781337569330
    Author:Jill West, Tamara Dean, Jean Andrews
    Publisher:Cengage Learning
    Text book image
    Concepts of Database Management
    Computer Engineering
    ISBN:9781337093422
    Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
    Publisher:Cengage Learning
    Text book image
    Prelude to Programming
    Computer Engineering
    ISBN:9780133750423
    Author:VENIT, Stewart
    Publisher:Pearson Education
    Text book image
    Sc Business Data Communications and Networking, T...
    Computer Engineering
    ISBN:9781119368830
    Author:FITZGERALD
    Publisher:WILEY