Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program in java using the concept of Encapsulation, inheritance, polymo

ID: 3721496 • Letter: C

Question

Create a program in java using the concept of Encapsulation, inheritance, polymorphism, abstract classes and interfaces
Description of the application
A restaurant wants a scheduling system for its employees. The software needs to allow the restaurant owner to schedule employees for up to 40 hours in a 7-day week. The restaurant is open from 6:00 AM to 10:00 PM. The system should include: 1. Schedule employees for up to 40 hours in a 7-day week 2. A printout of employee's work hours 3. The ability to change hours if necessary. Create a program in java using the concept of Encapsulation, inheritance, polymorphism, abstract classes and interfaces
Description of the application
A restaurant wants a scheduling system for its employees. The software needs to allow the restaurant owner to schedule employees for up to 40 hours in a 7-day week. The restaurant is open from 6:00 AM to 10:00 PM. The system should include: 1. Schedule employees for up to 40 hours in a 7-day week 2. A printout of employee's work hours 3. The ability to change hours if necessary. Create a program in java using the concept of Encapsulation, inheritance, polymorphism, abstract classes and interfaces
Description of the application
A restaurant wants a scheduling system for its employees. The software needs to allow the restaurant owner to schedule employees for up to 40 hours in a 7-day week. The restaurant is open from 6:00 AM to 10:00 PM. The system should include: 1. Schedule employees for up to 40 hours in a 7-day week 2. A printout of employee's work hours 3. The ability to change hours if necessary.

Explanation / Answer

Code:

Main class:

import java.util.Scanner;

/**
*
* @author Rohan
*/
public class RMS {

  
public static void main(String[] args) {
System.out.println("Welcome to Restorent Employee Management System!");
while(true){
System.out.println("1. Enter Owner Menu");
System.out.println("2. Show Emplyoee work Hours");
System.out.println("3. Exit");
  
Owner o = new Owner();
Scanner sc = new Scanner(System.in);
int ch = sc.nextInt();
switch(ch){
case 1:
o.setWorkHours();
break;
case 2:
o.hours();
break;
case 3: return;
}
}
  
}
  
}

Owner Class:

import java.util.ArrayList;
import java.util.Scanner;


/**
*
* @author Rohan
*/
public class Owner {
  
public static int workHours = 0;
  
ArrayList<Days> Holidays = new ArrayList<Days>();
int workingHours = 0;
  
void setWorkHours(){
while(true){
System.out.println("Menu for setting work hours!");
System.out.println("1. Set holidays");
System.out.println("2. Set Working hours");
System.out.println("3. Change Working Hours");
System.out.println("4. Exit");
  
  
Scanner sc = new Scanner(System.in);
int ch = 0;
int compulsoryHours = 0;
int holiday = 0;
int wh = 0;
int q = 0;
  
ch = sc.nextInt();
switch(ch){

case 1: System.out.println("Select days");
Days arr[] = Days.values();
for(Days d: arr){
System.out.println(d.ordinal()+" "+d);
}
int ch1 = 7;
ch1 = sc.nextInt();
switch(ch1){
case 0: Holidays.add(Days.Monday);
break;
case 1: Holidays.add(Days.Tuesday);
break;
case 2: Holidays.add(Days.Wednesday);
break;
case 3: Holidays.add(Days.Thusday);
break;
case 4: Holidays.add(Days.Friday);
break;
case 5: Holidays.add(Days.Saturday);
break;
case 6: Holidays.add(Days.Sunday);
break;
}
System.out.println(Holidays+" Added to holidays");
break;   
case 2: System.out.println("Set Working hours");
holiday = 7-Holidays.size();
compulsoryHours = 40 / holiday;
System.out.println("Mondatory hours to fill 40 hrs: "+ compulsoryHours);
workHours = sc.nextInt();
System.out.println("Working hours set to "+workHours+ "hrs");
break;
case 3: System.out.println("Change Hours");
holiday = 7-Holidays.size();
compulsoryHours = 40 / holiday;
System.out.println("Enter Hours more than "+compulsoryHours);
workHours = sc.nextInt();
System.out.println("Working hours set to "+workHours+ "hrs");
break;
case 4: return;
}
  
}
}
  
void hours(){
System.out.println("Working Hours for emplyoee set to "+ workHours + " hrs");
}
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote