Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Please keep this as simple as possible. I'm only in my second class, so maps have not been taught. We are doing this assignment

JAVA

Please keep this as simple as possible. I'm only in my second class, so maps have not been taught. We are doing this assignment under input/output section. We know: Memory management, Objects and Classes, User-defined methods, Arrays, Loops, Branches, and (of course) Variables. Please give help where possible.

For this assignment, you will need to write code to process the attached Salary.txt file. Each line in the file consists of a faculty members first name, last name, rank, and salary.

Sample data from file:

FirstName1,LastName1,assistant,79174.73 FirstName2,LastName2,associate,70817.75 FirstName3,LastName3,associate,69619.0 FirstName4,LastName4,full,116992.43 FirstName5,LastName5,full,116761.76 FirstName6,LastName6,full,123743.86

To read in the file, simply use:

File file = new File ("Salary.txt"); 

or

FileInputStream file = new FileInputStream ("Salary.txt"); 

Write a program to display the total salary for assistant professors, associate professors, full professors, and all faculty, respectively, and display the average salary for assistant professors, associate professors, full professors, and all faculty, respectively.

Your output should match the following:

Total Salary for Assistant Professors: $2XXXXXX1.91 Total Salary for Associate Professors: $2XXXXXX6.58 Total Salary for Professors: $3XXXXXX1.41 Total Salary for All Faculty: $8XXXXXX9.90 Average Salary for Assistant Professors: $ 6XXX9.55 Average Salary for Associate Professors: $ 8XXX9.26 Average Salary for Professors: $1XXXX9.37 Average Salary for All Faculty: $ 8XXX8.71 HINT: Use split() method defined in the String class to separate the different parts of each line in the file. Use printf() to format your output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago