Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in just basic There are 2 employees. Write a program with nested loops, to ask the yearly salary of each employee for 2 years. Your

in just basic

There are 2 employees. Write a program with nested loops, to ask the yearly salary of each employee for 2 years. Your program should keep track of the highest salary, lowest salary, and calculate the average salary of each employee.

i got his so far:

min=999999999999 max =0 for employee =1 to 2

for year = 1 to 2 print"enter salary for employee"; employee,"for year ";year

input salary totalSalary = totalSalary + salary

if (salary < min) then min = salary end if

if (salary > max) then max = salary end if

averageSalary = (totalSalary / 2) print" totalsalary is: " ;totalSalary print "average salary is: ";averageSalary print "min is: ";min print "max is: ";max next

next

BUT, i cannot separate ouput of employee 1 from employee 2.

here is the output i get:

average salary is: 50 min is: 100 max is: 100 enter salary for employee1 for year 2 ?25 totalsalary is: 125 average salary is: 62.5 min is: 25 max is: 100 enter salary for employee2 for year 1 ?50 totalsalary is: 175 average salary is: 87.5 min is: 25 max is: 100 enter salary for employee2 for year 2 ?75 totalsalary is: 250 average salary is: 125 min is: 25 max is: 100

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

What is an argument?

Answered: 1 week ago