Question: I need help on problem 3 and 4 could you please do it in java for me Problem 3 : Employee Salary Calculator Complete the

I need help on problem 3 and 4 could you please do it in java for me
Problem 3: Employee Salary Calculator
Complete the following program to determine the raise and new Salary for an employee by adding if... else statements to compute the raise. The
input to the program includes the current annual salary for the employee and a number indicating the performance rating (1=excellent,2= good,
and 3= poor). An employee with a rating of 1 will receive a 6% raise, an employee with a rating of 2 will receive a 4% raise, and one with a rating of
3 will receive a 1.5% raise.
// Salary.java
// Computes the raise and new salary for an employee
import java.util.Scanner;
public class Salary
(f)
public static void main (String[] args)
{
double currentSalary; // current annual salary
double rating; // performance rating
double raise; // dollar amount of the raise
I
Scanner scan = new Scanner(System.in);
// Get the current salary and performance rating
System.out.print ("Enter the current salary: ");
currentSalary = scan. nextDouble();
System.out.print ("Enter the performance rating: ");
rating = scan.nextDouble();
// Compute the raise -- Use if ... else
// Print the results
System.out.println ("Amount of your raise: $"+ raise);
System.out.println ("Your new salary: $"+(currentSalary + raise));
Problem 4: Powers of 2 File PowersOf2.java contains a skeleton of a program to read in an integer from the user and print out that many powers of
2, starting with 2^0.
a) Here are the first 4 powers of 2: 1248
b) Modify the program so that instead of just printing y 4 powers, you print which power each is, e.g.: Here are the first 4 powers of 2:2^0=12^1
=22^2=42^3=8
// PowersOf2.java
// Print out as many powers of 2 as the user requests
import java.util.Scanner;
public class Powersof2
({)
public static void main(String[] args)
{
int numPowersOf2; // How many powers of 2 to compute
int nextPowerOf2=1; // Current power of 2
int exponent; // Exponent for current power of 2-- this
// also serves as a counter for the loop
Scanner scan = new Scanner(System.in);
System.out.print ("How many powers of 2 would you like printed? ");
numPowersOf2= scan.nextInt();
// Print a message saying how many powers of 2 will be printed
// Initialize exponent -- the first thing printed is 2 to the what?
while ()
{
// Print out current power of 2
// Find next power of 2-- how do you get this from the last one?
// Increment exponent
I need help on problem 3 and 4 could you please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!