SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 13 Dec 2017 My Price 10.00

work but cannot produce screenshots public class Employee

Hello,

 

I have done all the work but cannot produce screenshots. public class Employee {

    private String name;
    private int monthlySalary;
   
   
    public Employee(String name, int monthlySalary) {
        super();
        this.name = name;
        this.monthlySalary = monthlySalary;
    }
   
   
    public int annualSalary() {
        return monthlySalary*12;
    }


    @Override
    public String toString() {
        return "name=" + name + ", monthlySalary=" + monthlySalary;
    }
   
}
Can you help? Another tutor was also stumped.public class Executive extends Employee {

    private int stockPrice;

    public Executive(String name, int monthlySalary , int stockPrice) {
        super(name, monthlySalary);
        this.stockPrice = stockPrice;
    }

    @Override
    public int annualSalary() {
        int bonus = 30000;
        if (stockPrice > 50) {
            return super.annualSalary() + bonus;
        } else {
            return super.annualSalary();
        }
    }

    @Override
    public String toString() {
        return super.toString() + " stockPrice=" + stockPrice;
    }
    
    
    
    
}import java.io.File;
import java.util.Scanner;

public class MainDriver {

    public static void main(String[] args) {

        Employee[] employee2014 = new Employee[10];
        Employee[] employee2015 = new Employee[10];
        int index2014 =0;
        int index2015 =0;

        try {
            File file = new File("data.txt");

            Scanner input = new Scanner(file);

            while (input.hasNextLine()) {
                String line = input.nextLine();
                String [] strSplit = line.split(" ");
                Employee e =null;
                if("Employee".equals(strSplit[1])) {
                    e = new Employee(strSplit[2], Integer.valueOf(strSplit[3]));
                } else if("Salesman".equals(strSplit[1])) {
                    e = new Salesman(strSplit[2], Integer.valueOf(strSplit[3]) , Integer.valueOf(strSplit[4]));
                } else if("Executive".equals(strSplit[1])) {
                    e = new Executive(strSplit[2], Integer.valueOf(strSplit[3]) , Integer.valueOf(strSplit[4]));
                }
                if("2014".equals(strSplit[0])) {
                    employee2014[index2014++] = e;
                } else {
                    employee2015[index2015++] = e;
                }
            }
            input.close();
           
            //2014 report
            int totalSalary = 0;
            for(int i=0 ; i < index2014 ; i++) {
                System.out.println(employee2014[i].toString());
                int annualSalary = employee2014[i].annualSalary();
                System.out.println("Annual Salary :" + annualSalary);
                totalSalary = totalSalary + annualSalary;
            }
           
            System.out.println("The average Salary for Employees in 2014 is : " + totalSalary/(index2014));
            System.out.println();
           
            //2015 report
            totalSalary = 0;
            for(int i=0 ; i < index2015 ; i++) {
                System.out.println(employee2015[i].toString());
                int annualSalary = employee2015[i].annualSalary();
                System.out.println("Annual Salary :" + annualSalary);
                totalSalary = totalSalary + annualSalary;
            }
           
            System.out.println("The average Salary for Employees in 2015 is : " + totalSalary/(index2015));
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }

}
public class Salesman extends Employee {

    private int annualSales;

    public Salesman(String name, int monthlySalary , int annualSales) {
        super(name, monthlySalary);
        this.annualSales = annualSales;
    }

    @Override
    public int annualSalary() {
        int commision = annualSales * 2 / 100;

        if (commision > 20000) {
            return super.annualSalary() + 20000;
        } else {
            return super.annualSalary() + commision;
        }
    }

    @Override
    public String toString() {
        return super.toString() + " annualSales=" + annualSales;
    }

}


Attachments:

Answers

(5)
Status NEW Posted 13 Dec 2017 07:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)