1 answer

I need the soft code ( Outline with comments ) of the main program that reads...

Question:

I need the soft code ( Outline with comments ) of the main program that reads in the employee data with the sorting, reading, and average functions as well as the class ( header file ). No hard code is necessary. Thank you!

Consider a program that will read employee data, sort the data by employee identification number, write out the sorted data, and compute various statistics about the data, such as the average age of an employee. Design a modular solution to this problem using CRCs and UML notation. What classes and methods did you identify during the design of your solution? Write complete specifications, including preconditions and postconditions, for each module. Additionally, write the class and function descriptors (without actually implementing the functions) along with comments for documentation. well create C). You may use any editor to produce UMLs. There are online sources as Note: You should read Appendix C to get familiar with UML. Requirements: CRC and UML for design, source code.

Answers

#include<stdio.h>

struct emp
{
int emp_id ;
char emp_name[10] ;
int age ;
} e[10],temp;

void get_emp(int n)
{
int i;
for(i = 0 ; i < n ; i++)
{
printf("Enter the employee identification number : ") ;
scanf("%d", &e[i].emp_id) ;
printf("Enter the name of employee : ") ;
scanf("%s", e[i].emp_name) ;
printf("Enter age of employee : ") ;
scanf("%d", &e[i].age) ;
}
printf("\nEmp_ID\tName \t age \n") ;
for(i = 0 ; i < n ; i++)
{
printf("%d \t %s \t %d\n", e[i].emp_id,e[i].emp_name, e[i].age) ;
}
}

void sort_emp(int n)
{
int i,j;
for (i = 1; i < n; i++)
for (j = 0; j < n - i; j++)
{
if (e[j].emp_id>e[j + 1].emp_id)
{
temp = e[j];
e[j] = e[j + 1];
e[j + 1] = temp;
}
}
printf("\n*****After Sorting*****\nEmp_ID\tName \t age \n") ;
for(i = 0 ; i < n ; i++)
{
printf("%d \t %s \t %d\n", e[i].emp_id,e[i].emp_name, e[i].age) ;
}
}

void age_avg(int n)
{
int avg=0,tot=0,i;
for(i = 0 ; i < n ; i++)
tot+=e[i].age;
avg=tot/2;
printf("Average age of employee is: %d\n",avg) ;
}
void main()
{
int i, n,j ;
printf("Enter the number of employees : ") ;
scanf("%d", &n) ;
//read data of emp
get_emp(n);
//sorting according to id number
sort_emp(n);
//calculate average of employee age
age_avg(n);
  
}

Enter the number of employees : 2 Enter the employee identification number: 456 Enter the name of employee: abc Enter age ot

.

Similar Solved Questions

1 answer
If a company pays dividends of $9300, stockholders' equity will be reduced by $9300. net income...
If a company pays dividends of $9300, stockholders' equity will be reduced by $9300. net income will be reduced by $9300. O retained earnings will be reduced by $9300. O both retained earnings and stockholders' equity will be reduced by $9300....
1 answer
Microbiology - Gram Positive (ONLY answer) [Q1] Mannitol salt agar is both selective and differential. -...
Microbiology - Gram Positive (ONLY answer) [Q1] Mannitol salt agar is both selective and differential. - True - False [Q2] Mueller Hinton medium is a selective and differential medium. - True - False [Q3] 6.5% Salt broth is used to distinguish - Streptococci and Enterococci - Streptococci and Staphy...
1 answer
Item 8 Review Part A The three parallel planes of charge shown in the figure (Figure...
Item 8 Review Part A The three parallel planes of charge shown in the figure (Figure 1)have surface charge densities-2 η, η, and-2 η Find the magnitude of the electric field in region1 Submit Request Answer ▼ Part B What is the direction of the electric field in region 1? Upward Do...
1 answer
Answer both parts (i) and (ii) (i) Suggest suitable reagents for the following transformations. H3C 2. он +HPO NH2 CH3 5 marks (ii) For the reactions given above in part (i) label the main functional...
Answer both parts (i) and (ii) (i) Suggest suitable reagents for the following transformations. H3C 2. он +HPO NH2 CH3 5 marks (ii) For the reactions given above in part (i) label the main functional groups of the starting materials and the products given. 5 marks] Answer both parts (i)...
1 answer
9. In a multifactor APT model, the coefficients on the macro factors are often called A....
9. In a multifactor APT model, the coefficients on the macro factors are often called A. systematic risk. B. factor sensitivities. C. idiosyncratic risk. D. factor betas. E. factor sensitivities and factor betas....
1 answer
Most ecosystems get their energy from which source? a. Sun b. Deep sea vents c. Gasoline...
Most ecosystems get their energy from which source? a. Sun b. Deep sea vents c. Gasoline d. Primary producers...
1 answer
Can anyone help solve this problem? 1. A buisiness man spends X hours on the telephone...
Can anyone help solve this problem? 1. A buisiness man spends X hours on the telephone during the day, where the cumulative distribution 0 function of X is If x < 0 ifx>2 (a) Show that the median m of X satisfies the equation m4 -16m2 +24 hence evaluate m. [Hint: substitute u m2 to solve t...
1 answer
Question 13 of 25 -/1 View Policies Current Attempt in Progress Uncle Kevin's Gifts signs a...
Question 13 of 25 -/1 View Policies Current Attempt in Progress Uncle Kevin's Gifts signs a three-month note payable to help finance increases in inventory for the Christmas shopping season. The note is signed on November 1 in the amount of $76600 with annual interest of 12%. What is the adjusti...
1 answer
Use the following information to answer the next question. The following diagram represents the emission lines...
Use the following information to answer the next question. The following diagram represents the emission lines that are produced for the Balmer Series of hydrogen. Each line is produced as an electron makes a transition from a higher Bohr energy level to n-2. Balmer Series Spectral Line Wavelengths ...
1 answer
2. The random variable X has PMF Joc, if x = 1,2,3,4 px(x) = 10 otherwise....
2. The random variable X has PMF Joc, if x = 1,2,3,4 px(x) = 10 otherwise. (a) Calculate the value of c. (b) Calculate the probability that X is an even number. (c) Calculate the probability that X is greater than 2. (d) Calculate the expectations of X and X2. (e) Calculate the variance of X (f) Com...
1 answer
The diagram above shows a cross-section view of a very long straight metal cylinder of radius ri ...
The diagram above shows a cross-section view of a very long straight metal cylinder of radius ri within a coaxial hollow metal cylinder of inner radius r2 and outer radius r3. The inner cylinder has a positive charge per unit length λ, whereas the outer cylinder has negative charge per unit l...
1 answer
Stuart Corporation paid one of its sales representatives $9,500 during the month of March. The rep...
Stuart Corporation paid one of its sales representatives $9,500 during the month of March. The rep is paid a base salary plus $15 per unit of product sold. During March, the rep sold 180 units. Required Calculate the total monthly cost of the sales representative's salary for each of the followi...
1 answer
Complete combustion of a #17.4*g# mass of propane would give rise to WHAT VOLUME of carbon dioxide at #1*atm# pressure, and #298*K# temperature?
Complete combustion of a #17.4*g# mass of propane would give rise to WHAT VOLUME of carbon dioxide at #1*atm# pressure, and #298*K# temperature?...
1 answer
Chapter 2, Problem 2/090 Four people are attempting to move a stage platform across the floor....
Chapter 2, Problem 2/090 Four people are attempting to move a stage platform across the floor. If they exert the horizontal forces shown, determine (a) the equivalent force-couple system at O and (b) the points on the x- and y-axes through which the line of action of the single resultant force R pas...
1 answer
Simon Company's year-end balance sheets follow. Current Yr 1 Yr Ago 2 Yrs Ago At December...
Simon Company's year-end balance sheets follow. Current Yr 1 Yr Ago 2 Yrs Ago At December 31 Assets Cash Accounts receivable, net Merchandise inventory Prepaid expenses Plant assets, net Total assets Liabilities and Equity Accounts payable Long-term notes payable secured by mortgages on plant as...
1 answer
JV, a corporation, was formed in 20X9 to design and manufacture electric cars. JV is 60...
JV, a corporation, was formed in 20X9 to design and manufacture electric cars. JV is 60 percent owned by AutoCo (a car manufacturer) and 40 percent owned by Electric Co (a developer of electric car technology). The decision-making authority of JV is equally shared between AutoCo and ElectricCo: the ...
1 answer
A Sample of gas (1764) at 6.00'c and orah Pressure is heated to 2540 and 2.45am farol pressure. what is le fall som...
A Sample of gas (1764) at 6.00'c and orah Pressure is heated to 2540 and 2.45am farol pressure. what is le fall some...
1 answer
1977M2. A uniform cylinder of mass M, and radius R is initially at rest on a...
1977M2. A uniform cylinder of mass M, and radius R is initially at rest on a rough horizontal surface. The moment of inertia of a cylinder about its axis is ½MR. A string, which is wrapped around the cylinder, is pulled upwards with a force T whose magnitude is 0.0Mg and whose direction is ma...