Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
39 views2 pages

Practice Problem 1

The document outlines a task to create a Java program for tracking employee performance ratings. The program should collect employee names and ratings, categorize them using a switch-case statement, and calculate the average rating while handling specific conditions like skipping poor ratings and stopping on a rating of 0. It includes constraints on data types and control flow for input validation.

Uploaded by

venkat Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Practice Problem 1

The document outlines a task to create a Java program for tracking employee performance ratings. The program should collect employee names and ratings, categorize them using a switch-case statement, and calculate the average rating while handling specific conditions like skipping poor ratings and stopping on a rating of 0. It includes constraints on data types and control flow for input validation.

Uploaded by

venkat Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practice Problem 1: Employee Performance Tracker

Problem Statement

A company wants to automate the process of tracking performance ratings for its employees.
You are tasked with building a simple Java program that:

1. Asks the user for the number of employees.


2. For each employee:

o Takes the employee name and rating (1 to 5) as input.

o Uses switch-case to print performance category:

▪ 5 → "Outstanding"

▪ 4 → "Excellent"
▪ 3 → "Good"

▪ 2 → "Needs Improvement"

▪ 1 → "Poor"

▪ Any other input → "Invalid Rating"

o If rating is 1, skip to the next employee using continue.

3. After processing all employees:

o Calculate and print the average rating (excluding invalid and poor ratings).
o If the loop encounters a rating of 0, use break to immediately stop the process
and alert "Rating input cancelled."

Constraints

• Use appropriate data types.

• Apply loops, conditionals, switch, continue, and break appropriately.

• Validate inputs with control flow.

Sample Input/Output

Enter number of employees: 4

Employee 1 Name: Alice


Enter rating (1-5): 5

Alice - Outstanding

Employee 2 Name: Bob

Enter rating (1-5): 1

Bob - Poor

Employee 3 Name: Carol

Enter rating (1-5): 4

Carol - Excellent

Employee 4 Name: Dave

Enter rating (1-5): 0

Rating input cancelled.

Average rating (excluding poor/invalid): 4.5

You might also like