Final answer:
To convert the ProjectedRaises class to an interactive application, you can use a Scanner object to accept salary values from the user. Then, calculate the projected raises and new salaries using the input values, and display the new salaries.
Step-by-step explanation:
To convert the ProjectedRaises class to an interactive application, we need to accept salary values from the user as input instead of assigning them in the code. Here's how you can do it:
Create a Scanner object to read input from the user.
Prompt the user to enter the salaries, and use the Scanner object to read and store them in variables.
Calculate the projected raises and new salaries using the same logic as before.
Display the new salaries to the user.
Here's an example of the code:
import java.util.Scanner;
public class ProjectedRaisesInteractive {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the first salary:");
double salary1 = scanner.nextDouble();
System.out.println("Enter the second salary:");
double salary2 = scanner.nextDouble();
// Calculate projected raises and new salaries
double raise1 = salary1 * 0.04;
double raise2 = salary2 * 0.04;
double newSalary1 = salary1 + raise1;
double newSalary2 = salary2 + raise2;
// Display the new salaries
System.out.println("New salary for employee 1: " + newSalary1);
System.out.println("New salary for employee 2: " + newSalary2);
}
}