I am trying to output the salary for each shift, but when outputted the salary shows up as 0.00 how can i correct this problem ? I have tried declaring the salary as float but i was unsuccessful ............................................................................................................
package overtime.pay;
import javax.swing.* ;
import java.util.Scanner;
/**
*
* @author whitneykenny
*/
public class OvertimePay {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner Hours_worked = new Scanner(System.in);
System.out.println("Enter how many hours worked ");
int total_hours = Hours_worked.nextInt();
if (total_hours == 40||total_hours < 40){
System.out.println("Employee did not make any over time ");
} else {
System.out.println("The employee made overtime");
}
final double first_shift = 17.00;
final double second_shift = 18.50;
final double third_shift = 22.00;
Scanner selected_shift = new Scanner(System.in);
System.out.println("Which shift was worked ");
String shift_worked = selected_shift.nextLine();
double salary = 0 ;
if (shift_worked == "first") {
salary = first_shift;
} else if (shift_worked == "second")
{salary = second_shift;
}else if (shift_worked == "third")
{
}
System.out.println("Your salary is " + salary );
}
}