1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sedaia [141]
3 years ago
5

Use BlueJ to write, test, and execute a program that reads a sequence of data for several employee objects from an input file. U

se notepad to create input file "inData.txt". File should be stored in the same folder where all files from BlueJ for this program are located.
Class Employee describes one employee object and has variables empID, fName, lName title of String type, and salary of type int. In addition, class Employee has constructor to initialize all data, getter methods to access data, and has the following methods:
public boolean isHighEarner() // returns true if employee has salary above 100000 and false otherwise
public String toString() // returns string with all employee’s data in one line separated by tabs.

Design class Department that has instance variable list which is of ArrayList type. Variable list is initialized in the constructor by reading data for each employee from an input file. Each line of input file "inData.txt" has empID, fName, lName title, and salary in this order, and separated by a space. Input file should contain minimum of 8 employees, but not more than 100. Program should stop readding from the input file when it reaches the end of file, or if number of emplyees reaches 100. The data for the first five employees in the input file should be as follows:
1234e2 Ann Smith manager 67000
1233e7 Mark Lewis programmer 111000
9876e2 Ford Smith secretary 49000
3451e7 Ann Taylor programmer 138000
4567e9 Sue Lee programmer 91000
… Add remaining employees of your choice.

Class Department also has the following methods:
// Returns string representation of list of all employees (each row has data for one employee)
• public String toString()

//Prints "List of high earner employees in the department " followed by complete data for each high earner employee
• public void printHighEarners()

// Method returns Employee object with highest salary. In case of multiple employees with the same highest salary,
// return first such employee in the list.
• public Employee highestEarner()

// Method accepts a title and returns count of employees with given title.
• public int countEmployeesWithTitle(String title)

// Returns ArrayList of all employees from the list that are both highEarners and programmers.
• public ArrayList highEarnerProgrammers()

The first method and the last three methods do not print anything, they just return the specified data. Print English explanation about the method results at the place where those methods are invoked. None of the methods should change the list of employees. That means that the list of employees remains the same before and after invoking any of the methods.
Class TestEmployeeList will have main method. Invoke each of the five methods from Department class. If method countEmployeesWithTitle returns zero, report that there are no employees with specified title, otherwise print count with full sentence. Test the method twice: once by passing title "programmer" and second time by passing a title that none of employees has.

NOTE: Do not forget to append throws IOException to the constructor of the class Department and to the main method header in class TestEmployeeList. In addition, you have to import the following packages in order to use Scanner and ArrayList classes.
import java.io.*;
import java.util.*;

Every class should start with comment that includes your name, class section, meeting days, project number and date of submission and brief description what is the class about.
Computers and Technology
1 answer:
Serjik [45]3 years ago
5 0
I don’t understand it
You might be interested in
Common icons found on the Windows desktop are _____.
Ket [755]

Answers- My computer, My Documents and Recyle bin.

2,3,4 option

5 0
3 years ago
Read 2 more answers
Write a loop that reads strings from standard input where the string is either "land", "air", or "water". The loop terminates wh
Setler79 [48]

The loop terminates when "xxxxx" is read in. If the word is land, the string followed by "land" get outputted. The same with air, and water.

Explanation:

int land = 0;

int air = 0;

int water = 0;

String word = "";

while(!(word.equals("xxxxx"))) {

word = stdin.next();

if(word.equals("land")) {

   land++;

}else if(word.equals("air")) {

   air++;

}else if(word.equals("water")) {

   water++;

}  

}

System.out.println("land:" + land);

System.out.println("air:" + air);

System.out.println("water:" + water);

5 0
3 years ago
What are the 3 biggest advancements in computers?
Georgia [21]

Answer:

abacus . Mesopotamia or China, possibly several thousand years BCE. ...

binary math . Pingala, India, 3rd century BCE. ...

punched card . Basile Bouchon, France, 1725. ...

Explanation:

:)

6 0
2 years ago
Which are types of lines? Choose three answers.
alekssr [168]
Straight
Curvilinear
Rectilinear
7 0
3 years ago
Which of the following are incorrect? Group of answer choices An interface can contain constructors. You may declare a final abs
spin [16.1K]

Answer:

Explanation:

1. The answer is No, interface cannot have constructors. ... In order to call any method we need an object since there is no need to have object of interface, there is no need of having constructor in interface (Constructor is being called during creation of object).

2.A final class is considered complete and can not be subclassed (It's methods can not be overridden ). In case of abstract class, we have to proved implementation to abstract methods in subclasses. A final class can not have abstract methods and an abstract class can not be declared final.

3.private constructors are acceptable, however the class should be marked final instead, as doing so means the class is to be extended.

4.Yes! Abstract classes can have constructors! Yes, when we define a class to be an Abstract Class it cannot be instantiated(i.e an object cannot be created) but that does not mean an Abstract class cannot have a constructor. Each abstract class must have a concrete subclass which will implement the abstract methods of that abstract class.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Assume you have just started a new job, have a car loan, and have a student loan. You have just received a cash gift of $1,000 f
    14·1 answer
  • #Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The fun
    14·1 answer
  • Universal Containers is tracking the interviewer's ratings of candidate in Salesforce. They would like to easily link the Candid
    9·1 answer
  • Put these steps for managing your study time in chronological order. 1 set aside the same time each day 2 Identify the best time
    14·1 answer
  • Which branch of science helps avoid or minimize stress related injuries at workplace? _____ is a branch of science that aims to
    15·1 answer
  • What is the age group for the silent genration
    10·1 answer
  • A style ____ is a series of rules that defines the style for a web page or an entire web site.
    6·1 answer
  • _____ describes the layout of the screen. Block-based, Interface, Editor, Player
    11·2 answers
  • How do you give brianliest
    13·1 answer
  • Reading (BCK FORM 2C IT 2020-2021)
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!