ex1) two teams fighting for playing volleyball in school premises,where one team1 own the ball and team2 own the net .team1 waiting until team2 leave the net and team2 waiting until team1 leave the ball.
2)starvation:
ex1)
Kid waiting for remote control when his parents watching the TV.In this scenario remote control always in the hans of parents.Kid has to wait for a longtime.
3)race
ex1)
in a hotel 45 tables are available and customers have to reserve them through phone calls, receptionists will answer the call,customer's whose call answerd first by receptionist will get a table,even though customer had tried the call earlier while receptionist on other call can't get the table.
Up next for you in Electrical Engineering
Goal: The purpose of this
exercise is to create Finite
State Machine (FSM) which
can detect a certain eight …
import java.util.Scanner;
public class GrossPay {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Asking the user to enter employee name
System.out.print("Enter employee name: ");
String name = sc.nextLine();
// Asking for full time or part time
System.out.print("Press F for Full Time or P for Part Time: ");
char choice = sc.next().charAt(0);
if(choice == 'P') {
System.out.println("--- Part Time Employee ---");
System.out.print("Enter rate per hour: "); // Asking the user to enter rate per hour
double rate_per_hour = sc.nextDouble();
System.out.print("Enter no. of hours worked: "); // Asking the user to enter no of hours worked
int hours_worked = sc.nextInt();
System.out.print("Enter no. of overtime: "); // Asking the user to enter no of over time
int overtime = sc.nextInt();
System.out.println("\n-------------------------------------");
System.out.println("Employee Name: "+name);
double basic_pay;
basic_pay = rate_per_hour * hours_worked; // Calculating basic pay
System.out.println("Basic Pay:\t"+basic_pay);
double overtime_pay;
overtime_pay = (rate_per_hour + (rate_per_hour * 0.25)) * overtime; // Calculating overtime play
System.out.println("Overtime Pay:\t"+overtime_pay);
System.out.println("\n-------------------------------------");
double gross_pay;
gross_pay = basic_pay + overtime_pay; //Calculating gross pay
System.out.println("Gross Pay:\t"+gross_pay);
}
}
}