need a simple code for the following
Read Departments and Employees from a file, and print a sorted list of employees for a specified department.
Assume the file follows the following data:
Dept:10, Accounts, Boston
Emp:1, john, doe, 10000
Emp:2, jane, doe, 20000
Emp:3, sarah, smith, 30000
Dept:20, Development, Moscow
Emp:4, ivan, pavlov, 10000
Emp:5, dmitry, panov, 20000
Emp:6, sergei, meigyesi, 30000
Dept:30, Marketing, Beijing
Emp:7, yao, ming, 20000
Emp:8, michelle, yeoh, 30000
Provide the following command line menu:
1. Read from file // if the user chooses this option, ask for file name and load the above data from that file
2. Print sorted list of all departments
3. Print List of all employees for a department, sorted by name
4. Print List of all empoloyees for a department, sorted by salary
note: The data of the employees contain lower-case data for names. But you will print the employees in Title Case.
From the data in the file, I need to see the part of the line before the first ":" to know whether it is
a dept record or an emp record then, from the data after the ":", i need to take the data between the commas and
construct a Dept object or an Emp object then i need to do the sorting of the emp objects as per the menu
option chosen by the user, as mentioned in the question.
Re: need a simple code for the following
Quote:
Originally Posted by
payal
need a simple code for the following...
I think I speak for all in wishing you the greatest success in creating this code and in passing your assignment. But please understand that we are not here to provide you with "simple code for the following". Please show us *your* code and ask any specific questions, and we'll be more than happy to help.
Re: need a simple code for the following
Have you started writing the program yet? or are you still in the structural programming development stages?
Re: need a simple code for the following
A good starting place might be researching about reading and writing (input/output) files online.