SlideShare a Scribd company logo
1 of 9
Download to read offline
//operating system ubuntu,Linux,Mac
public class SuperMarket {
/*Variable declaration*/
private int employeeId;
private double hourlyRate;
private double regularHour;
private double overtimeHour;
private double grossPay;
private double netpay;
/*Getter and setter methods*/
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public double getHourlyRate() {
return hourlyRate;
}
public void setHourlyRate(double hourlyRate) {
this.hourlyRate = hourlyRate;
}
public double getRegularHour() {
return regularHour;
}
public void setRegularHour(double regularHour) {
this.regularHour = regularHour;
}
public double getOvertimeHour() {
return overtimeHour;
}
public void setOvertimeHour(double overtimeHour) {
this.overtimeHour = overtimeHour;
}
public double getGrossPay() {
return grossPay;
}
public void setGrossPay(double grossPay) {
this.grossPay = grossPay;
}
public double getNetpay() {
return netpay;
}
public void setNetpay(double netpay) {
this.netpay = netpay;
}
}
/********Driver class***********/
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;
public class SuperMarketDriver {
/*Variable Declaration*/
private int numberOfEmployees;
private final int tax=30;
private final int parking=10;
SuperMarket employees[];
/*List for storing Employee of Super market*/
List list=new ArrayList();
/*readInput method for reading employee information*/
public void readInput(){
/*User Input*/
Scanner input=new Scanner(System.in);
System.out.println("Please enter the number of Employees");
numberOfEmployees=input.nextInt();
/*Creating array of supermarket*/
employees=new SuperMarket[numberOfEmployees];
int i=0;
/*Loop run number of employees times*/
while(numberOfEmployees>0){
employees[i]=new SuperMarket();
System.out.println("Please Enter Employee Id");
employees[i].setEmployeeId(input.nextInt());
System.out.println("Please Enter Hourly Rate of Pay");
employees[i].setHourlyRate(input.nextDouble());
System.out.println("Please Enter Number of regular hour");
employees[i].setRegularHour(input.nextDouble());
System.out.println("Please Enter overtime hours");
employees[i].setOvertimeHour(input.nextDouble());
/*Calculation of grosspay*/
double
grossPay=(employees[i].getRegularHour()*employees[i].getHourlyRate())+(employees[i].getOv
ertimeHour()*(employees[i].getHourlyRate()*1.5));
employees[i].setGrossPay(grossPay);
/*Calculation of Netpay*/
double netPay=grossPay-(grossPay*tax/100)-parking;
employees[i].setNetpay(netPay);
/*Adding to list*/
list.add(employees[i]);
i++;
numberOfEmployees--;
}
}
/*Printing employees details using List iterator*/
public void printData(){
ListIterator itr=list.listIterator();
SuperMarket employee;
while(itr.hasNext()){
employee=itr.next();
System.out.println("********************");
System.out.println("Employee Id: "+employee.getEmployeeId()+" "+"Employee
Hourly Rate: "+employee.getHourlyRate()+" "
+"Employee Regular Hour: "+employee.getRegularHour()+" "
+"Employee Overtime Hour: "+employee.getOvertimeHour()+" "
+"Employee gross pay: "+employee.getGrossPay()+" "
+"Employee NetPay: "+employee.getNetpay());
}
}
/*Main method start*/
public static void main(String[] args) {
SuperMarketDriver object=new SuperMarketDriver();
/*Calling readInput method*/
object.readInput();
/*Calling Print data method*/
object.printData();
}
}
/***************output************/
Please enter the number of Employees
2
Please Enter Employee Id
123
Please Enter Hourly Rate of Pay
200
Please Enter Number of regular hour
6
Please Enter overtime hours
3
Please Enter Employee Id
124
Please Enter Hourly Rate of Pay
400
Please Enter Number of regular hour
6
Please Enter overtime hours
2
********************
Employee Id: 123
Employee Hourly Rate: 200.0
Employee Regular Hour: 6.0
Employee Overtime Hour: 3.0
Employee gross pay: 2100.0
Employee NetPay: 1460.0
********************
Employee Id: 124
Employee Hourly Rate: 400.0
Employee Regular Hour: 6.0
Employee Overtime Hour: 2.0
Employee gross pay: 3600.0
Employee NetPay: 2510.0
Thanks
Solution
//operating system ubuntu,Linux,Mac
public class SuperMarket {
/*Variable declaration*/
private int employeeId;
private double hourlyRate;
private double regularHour;
private double overtimeHour;
private double grossPay;
private double netpay;
/*Getter and setter methods*/
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public double getHourlyRate() {
return hourlyRate;
}
public void setHourlyRate(double hourlyRate) {
this.hourlyRate = hourlyRate;
}
public double getRegularHour() {
return regularHour;
}
public void setRegularHour(double regularHour) {
this.regularHour = regularHour;
}
public double getOvertimeHour() {
return overtimeHour;
}
public void setOvertimeHour(double overtimeHour) {
this.overtimeHour = overtimeHour;
}
public double getGrossPay() {
return grossPay;
}
public void setGrossPay(double grossPay) {
this.grossPay = grossPay;
}
public double getNetpay() {
return netpay;
}
public void setNetpay(double netpay) {
this.netpay = netpay;
}
}
/********Driver class***********/
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Scanner;
public class SuperMarketDriver {
/*Variable Declaration*/
private int numberOfEmployees;
private final int tax=30;
private final int parking=10;
SuperMarket employees[];
/*List for storing Employee of Super market*/
List list=new ArrayList();
/*readInput method for reading employee information*/
public void readInput(){
/*User Input*/
Scanner input=new Scanner(System.in);
System.out.println("Please enter the number of Employees");
numberOfEmployees=input.nextInt();
/*Creating array of supermarket*/
employees=new SuperMarket[numberOfEmployees];
int i=0;
/*Loop run number of employees times*/
while(numberOfEmployees>0){
employees[i]=new SuperMarket();
System.out.println("Please Enter Employee Id");
employees[i].setEmployeeId(input.nextInt());
System.out.println("Please Enter Hourly Rate of Pay");
employees[i].setHourlyRate(input.nextDouble());
System.out.println("Please Enter Number of regular hour");
employees[i].setRegularHour(input.nextDouble());
System.out.println("Please Enter overtime hours");
employees[i].setOvertimeHour(input.nextDouble());
/*Calculation of grosspay*/
double
grossPay=(employees[i].getRegularHour()*employees[i].getHourlyRate())+(employees[i].getOv
ertimeHour()*(employees[i].getHourlyRate()*1.5));
employees[i].setGrossPay(grossPay);
/*Calculation of Netpay*/
double netPay=grossPay-(grossPay*tax/100)-parking;
employees[i].setNetpay(netPay);
/*Adding to list*/
list.add(employees[i]);
i++;
numberOfEmployees--;
}
}
/*Printing employees details using List iterator*/
public void printData(){
ListIterator itr=list.listIterator();
SuperMarket employee;
while(itr.hasNext()){
employee=itr.next();
System.out.println("********************");
System.out.println("Employee Id: "+employee.getEmployeeId()+" "+"Employee
Hourly Rate: "+employee.getHourlyRate()+" "
+"Employee Regular Hour: "+employee.getRegularHour()+" "
+"Employee Overtime Hour: "+employee.getOvertimeHour()+" "
+"Employee gross pay: "+employee.getGrossPay()+" "
+"Employee NetPay: "+employee.getNetpay());
}
}
/*Main method start*/
public static void main(String[] args) {
SuperMarketDriver object=new SuperMarketDriver();
/*Calling readInput method*/
object.readInput();
/*Calling Print data method*/
object.printData();
}
}
/***************output************/
Please enter the number of Employees
2
Please Enter Employee Id
123
Please Enter Hourly Rate of Pay
200
Please Enter Number of regular hour
6
Please Enter overtime hours
3
Please Enter Employee Id
124
Please Enter Hourly Rate of Pay
400
Please Enter Number of regular hour
6
Please Enter overtime hours
2
********************
Employee Id: 123
Employee Hourly Rate: 200.0
Employee Regular Hour: 6.0
Employee Overtime Hour: 3.0
Employee gross pay: 2100.0
Employee NetPay: 1460.0
********************
Employee Id: 124
Employee Hourly Rate: 400.0
Employee Regular Hour: 6.0
Employee Overtime Hour: 2.0
Employee gross pay: 3600.0
Employee NetPay: 2510.0
Thanks

More Related Content

Similar to operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf

package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdf
anwarsadath111
 
Create a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdfCreate a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdf
feelingspaldi
 
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docxmaJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
infantsuk
 
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdfg++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
arakalamkah11
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
fathimafancy
 
This code has nine errors- but I don't know how to solve it- Please gi (1).pdf
This code has nine errors- but I don't know how to solve it- Please gi (1).pdfThis code has nine errors- but I don't know how to solve it- Please gi (1).pdf
This code has nine errors- but I don't know how to solve it- Please gi (1).pdf
aamousnowov
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
herminaherman
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
rajeshjangid1865
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdf
nipuns1983
 
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docxUser.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
dickonsondorris
 
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdfI am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
petercoiffeur18
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
aparnatiwari291
 

Similar to operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf (20)

package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdf
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
Create a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdfCreate a C# applicationYou are to create a class object called “Em.pdf
Create a C# applicationYou are to create a class object called “Em.pdf
 
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docxmaJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
maJavaProjectFinalExam.classpathmaJavaProjectFinalExam.p.docx
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdfg++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
 
C++ project
C++ projectC++ project
C++ project
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
4.3 Hibernate example.docx
4.3 Hibernate example.docx4.3 Hibernate example.docx
4.3 Hibernate example.docx
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
This code has nine errors- but I don't know how to solve it- Please gi (1).pdf
This code has nine errors- but I don't know how to solve it- Please gi (1).pdfThis code has nine errors- but I don't know how to solve it- Please gi (1).pdf
This code has nine errors- but I don't know how to solve it- Please gi (1).pdf
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
 
package employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdfpackage employeeType.employee;public abstract class Employee {  .pdf
package employeeType.employee;public abstract class Employee {  .pdf
 
for this particular program how do i create the input innotepad 1st ?#include...
for this particular program how do i create the input innotepad 1st ?#include...for this particular program how do i create the input innotepad 1st ?#include...
for this particular program how do i create the input innotepad 1st ?#include...
 
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docxUser.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdfI am trying to change this code from STRUCTS to CLASSES, the members.pdf
I am trying to change this code from STRUCTS to CLASSES, the members.pdf
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
 

More from arasanmobiles

1. The evolution of transportation has generally led to changes in u.pdf
1. The evolution of transportation has generally led to changes in u.pdf1. The evolution of transportation has generally led to changes in u.pdf
1. The evolution of transportation has generally led to changes in u.pdf
arasanmobiles
 
1) Name four properties of an OpenFileDialog that we often set prior.pdf
1) Name four properties of an OpenFileDialog that we often set prior.pdf1) Name four properties of an OpenFileDialog that we often set prior.pdf
1) Name four properties of an OpenFileDialog that we often set prior.pdf
arasanmobiles
 
Main File (usestudentacc.cpp)#includeiostream #include .pdf
 Main File (usestudentacc.cpp)#includeiostream #include .pdf Main File (usestudentacc.cpp)#includeiostream #include .pdf
Main File (usestudentacc.cpp)#includeiostream #include .pdf
arasanmobiles
 
DBA Company Income Statement For the period ended December 31,.pdf
    DBA Company   Income Statement   For the period ended December 31,.pdf    DBA Company   Income Statement   For the period ended December 31,.pdf
DBA Company Income Statement For the period ended December 31,.pdf
arasanmobiles
 
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdfPhenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
arasanmobiles
 
Yes both men and women differ in their thinking, research has proved.pdf
Yes both men and women differ in their thinking, research has proved.pdfYes both men and women differ in their thinking, research has proved.pdf
Yes both men and women differ in their thinking, research has proved.pdf
arasanmobiles
 
When using some Sounds and Audio Devices functions you see a message.pdf
When using some Sounds and Audio Devices functions you see a message.pdfWhen using some Sounds and Audio Devices functions you see a message.pdf
When using some Sounds and Audio Devices functions you see a message.pdf
arasanmobiles
 
The racial and ethnic makeup of the American people is in flux. New .pdf
The racial and ethnic makeup of the American people is in flux. New .pdfThe racial and ethnic makeup of the American people is in flux. New .pdf
The racial and ethnic makeup of the American people is in flux. New .pdf
arasanmobiles
 

More from arasanmobiles (20)

a) Here, H2PO4- Acts as acid and HPO42- as salt.In equation pKa of.pdf
a) Here, H2PO4- Acts as acid and HPO42- as salt.In equation pKa of.pdfa) Here, H2PO4- Acts as acid and HPO42- as salt.In equation pKa of.pdf
a) Here, H2PO4- Acts as acid and HPO42- as salt.In equation pKa of.pdf
 
1. The evolution of transportation has generally led to changes in u.pdf
1. The evolution of transportation has generally led to changes in u.pdf1. The evolution of transportation has generally led to changes in u.pdf
1. The evolution of transportation has generally led to changes in u.pdf
 
1) Transition state 2) Threshold energy 3) Catalysts or Intermed.pdf
1) Transition state 2) Threshold energy 3) Catalysts or Intermed.pdf1) Transition state 2) Threshold energy 3) Catalysts or Intermed.pdf
1) Transition state 2) Threshold energy 3) Catalysts or Intermed.pdf
 
1) Name four properties of an OpenFileDialog that we often set prior.pdf
1) Name four properties of an OpenFileDialog that we often set prior.pdf1) Name four properties of an OpenFileDialog that we often set prior.pdf
1) Name four properties of an OpenFileDialog that we often set prior.pdf
 
Main File (usestudentacc.cpp)#includeiostream #include .pdf
 Main File (usestudentacc.cpp)#includeiostream #include .pdf Main File (usestudentacc.cpp)#includeiostream #include .pdf
Main File (usestudentacc.cpp)#includeiostream #include .pdf
 
Ecell = Eocell - (0.0592n)log (more dilute solnmore concd soln). .pdf
  Ecell = Eocell - (0.0592n)log (more dilute solnmore concd soln). .pdf  Ecell = Eocell - (0.0592n)log (more dilute solnmore concd soln). .pdf
Ecell = Eocell - (0.0592n)log (more dilute solnmore concd soln). .pdf
 
DBA Company Income Statement For the period ended December 31,.pdf
    DBA Company   Income Statement   For the period ended December 31,.pdf    DBA Company   Income Statement   For the period ended December 31,.pdf
DBA Company Income Statement For the period ended December 31,.pdf
 
Indicate whether the solute solid is generally so.pdf
                     Indicate whether the solute solid is generally so.pdf                     Indicate whether the solute solid is generally so.pdf
Indicate whether the solute solid is generally so.pdf
 
in HCl [H+] concentration = 0.12M pH of HCl = -lo.pdf
                     in HCl [H+] concentration = 0.12M pH of HCl = -lo.pdf                     in HCl [H+] concentration = 0.12M pH of HCl = -lo.pdf
in HCl [H+] concentration = 0.12M pH of HCl = -lo.pdf
 
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdfPhenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
Phenanthrene is a polycyclic aromatic hydrocarbon composed of three .pdf
 
B. When dissolved solute and undissolved solute e.pdf
                     B. When dissolved solute and undissolved solute e.pdf                     B. When dissolved solute and undissolved solute e.pdf
B. When dissolved solute and undissolved solute e.pdf
 
Yes both men and women differ in their thinking, research has proved.pdf
Yes both men and women differ in their thinking, research has proved.pdfYes both men and women differ in their thinking, research has proved.pdf
Yes both men and women differ in their thinking, research has proved.pdf
 
What is the probability that a five-card poker hand contains the a.pdf
What is the probability that a five-card poker hand contains the a.pdfWhat is the probability that a five-card poker hand contains the a.pdf
What is the probability that a five-card poker hand contains the a.pdf
 
When using some Sounds and Audio Devices functions you see a message.pdf
When using some Sounds and Audio Devices functions you see a message.pdfWhen using some Sounds and Audio Devices functions you see a message.pdf
When using some Sounds and Audio Devices functions you see a message.pdf
 
We can better understand it with the help of examples.Red flower -.pdf
We can better understand it with the help of examples.Red flower -.pdfWe can better understand it with the help of examples.Red flower -.pdf
We can better understand it with the help of examples.Red flower -.pdf
 
The racial and ethnic makeup of the American people is in flux. New .pdf
The racial and ethnic makeup of the American people is in flux. New .pdfThe racial and ethnic makeup of the American people is in flux. New .pdf
The racial and ethnic makeup of the American people is in flux. New .pdf
 
The ion responsible is HCO3-.HCO3- is the conjugate base of the we.pdf
The ion responsible is HCO3-.HCO3- is the conjugate base of the we.pdfThe ion responsible is HCO3-.HCO3- is the conjugate base of the we.pdf
The ion responsible is HCO3-.HCO3- is the conjugate base of the we.pdf
 
The causal relationship in epidemiology is generally an observation .pdf
The causal relationship in epidemiology is generally an observation .pdfThe causal relationship in epidemiology is generally an observation .pdf
The causal relationship in epidemiology is generally an observation .pdf
 
Since Lithium sulfate is an ionic compound and is soluble in water, .pdf
Since Lithium sulfate is an ionic compound and is soluble in water, .pdfSince Lithium sulfate is an ionic compound and is soluble in water, .pdf
Since Lithium sulfate is an ionic compound and is soluble in water, .pdf
 
Microbiology is the study of microscopic organisms such as virus, ba.pdf
Microbiology is the study of microscopic organisms such as virus, ba.pdfMicrobiology is the study of microscopic organisms such as virus, ba.pdf
Microbiology is the study of microscopic organisms such as virus, ba.pdf
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 

operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf

  • 1. //operating system ubuntu,Linux,Mac public class SuperMarket { /*Variable declaration*/ private int employeeId; private double hourlyRate; private double regularHour; private double overtimeHour; private double grossPay; private double netpay; /*Getter and setter methods*/ public int getEmployeeId() { return employeeId; } public void setEmployeeId(int employeeId) { this.employeeId = employeeId; } public double getHourlyRate() { return hourlyRate; } public void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } public double getRegularHour() { return regularHour; } public void setRegularHour(double regularHour) { this.regularHour = regularHour; } public double getOvertimeHour() { return overtimeHour; } public void setOvertimeHour(double overtimeHour) { this.overtimeHour = overtimeHour; }
  • 2. public double getGrossPay() { return grossPay; } public void setGrossPay(double grossPay) { this.grossPay = grossPay; } public double getNetpay() { return netpay; } public void setNetpay(double netpay) { this.netpay = netpay; } } /********Driver class***********/ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import java.util.Scanner; public class SuperMarketDriver { /*Variable Declaration*/ private int numberOfEmployees; private final int tax=30; private final int parking=10; SuperMarket employees[]; /*List for storing Employee of Super market*/ List list=new ArrayList(); /*readInput method for reading employee information*/ public void readInput(){ /*User Input*/ Scanner input=new Scanner(System.in); System.out.println("Please enter the number of Employees"); numberOfEmployees=input.nextInt(); /*Creating array of supermarket*/ employees=new SuperMarket[numberOfEmployees];
  • 3. int i=0; /*Loop run number of employees times*/ while(numberOfEmployees>0){ employees[i]=new SuperMarket(); System.out.println("Please Enter Employee Id"); employees[i].setEmployeeId(input.nextInt()); System.out.println("Please Enter Hourly Rate of Pay"); employees[i].setHourlyRate(input.nextDouble()); System.out.println("Please Enter Number of regular hour"); employees[i].setRegularHour(input.nextDouble()); System.out.println("Please Enter overtime hours"); employees[i].setOvertimeHour(input.nextDouble()); /*Calculation of grosspay*/ double grossPay=(employees[i].getRegularHour()*employees[i].getHourlyRate())+(employees[i].getOv ertimeHour()*(employees[i].getHourlyRate()*1.5)); employees[i].setGrossPay(grossPay); /*Calculation of Netpay*/ double netPay=grossPay-(grossPay*tax/100)-parking; employees[i].setNetpay(netPay); /*Adding to list*/ list.add(employees[i]); i++; numberOfEmployees--; } } /*Printing employees details using List iterator*/ public void printData(){ ListIterator itr=list.listIterator(); SuperMarket employee; while(itr.hasNext()){ employee=itr.next(); System.out.println("********************"); System.out.println("Employee Id: "+employee.getEmployeeId()+" "+"Employee Hourly Rate: "+employee.getHourlyRate()+" " +"Employee Regular Hour: "+employee.getRegularHour()+" "
  • 4. +"Employee Overtime Hour: "+employee.getOvertimeHour()+" " +"Employee gross pay: "+employee.getGrossPay()+" " +"Employee NetPay: "+employee.getNetpay()); } } /*Main method start*/ public static void main(String[] args) { SuperMarketDriver object=new SuperMarketDriver(); /*Calling readInput method*/ object.readInput(); /*Calling Print data method*/ object.printData(); } } /***************output************/ Please enter the number of Employees 2 Please Enter Employee Id 123 Please Enter Hourly Rate of Pay 200 Please Enter Number of regular hour 6 Please Enter overtime hours 3 Please Enter Employee Id 124 Please Enter Hourly Rate of Pay 400 Please Enter Number of regular hour 6 Please Enter overtime hours 2 ********************
  • 5. Employee Id: 123 Employee Hourly Rate: 200.0 Employee Regular Hour: 6.0 Employee Overtime Hour: 3.0 Employee gross pay: 2100.0 Employee NetPay: 1460.0 ******************** Employee Id: 124 Employee Hourly Rate: 400.0 Employee Regular Hour: 6.0 Employee Overtime Hour: 2.0 Employee gross pay: 3600.0 Employee NetPay: 2510.0 Thanks Solution //operating system ubuntu,Linux,Mac public class SuperMarket { /*Variable declaration*/ private int employeeId; private double hourlyRate; private double regularHour; private double overtimeHour; private double grossPay; private double netpay; /*Getter and setter methods*/ public int getEmployeeId() { return employeeId; } public void setEmployeeId(int employeeId) { this.employeeId = employeeId; } public double getHourlyRate() { return hourlyRate;
  • 6. } public void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } public double getRegularHour() { return regularHour; } public void setRegularHour(double regularHour) { this.regularHour = regularHour; } public double getOvertimeHour() { return overtimeHour; } public void setOvertimeHour(double overtimeHour) { this.overtimeHour = overtimeHour; } public double getGrossPay() { return grossPay; } public void setGrossPay(double grossPay) { this.grossPay = grossPay; } public double getNetpay() { return netpay; } public void setNetpay(double netpay) { this.netpay = netpay; } } /********Driver class***********/ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import java.util.Scanner;
  • 7. public class SuperMarketDriver { /*Variable Declaration*/ private int numberOfEmployees; private final int tax=30; private final int parking=10; SuperMarket employees[]; /*List for storing Employee of Super market*/ List list=new ArrayList(); /*readInput method for reading employee information*/ public void readInput(){ /*User Input*/ Scanner input=new Scanner(System.in); System.out.println("Please enter the number of Employees"); numberOfEmployees=input.nextInt(); /*Creating array of supermarket*/ employees=new SuperMarket[numberOfEmployees]; int i=0; /*Loop run number of employees times*/ while(numberOfEmployees>0){ employees[i]=new SuperMarket(); System.out.println("Please Enter Employee Id"); employees[i].setEmployeeId(input.nextInt()); System.out.println("Please Enter Hourly Rate of Pay"); employees[i].setHourlyRate(input.nextDouble()); System.out.println("Please Enter Number of regular hour"); employees[i].setRegularHour(input.nextDouble()); System.out.println("Please Enter overtime hours"); employees[i].setOvertimeHour(input.nextDouble()); /*Calculation of grosspay*/ double grossPay=(employees[i].getRegularHour()*employees[i].getHourlyRate())+(employees[i].getOv ertimeHour()*(employees[i].getHourlyRate()*1.5)); employees[i].setGrossPay(grossPay); /*Calculation of Netpay*/ double netPay=grossPay-(grossPay*tax/100)-parking; employees[i].setNetpay(netPay);
  • 8. /*Adding to list*/ list.add(employees[i]); i++; numberOfEmployees--; } } /*Printing employees details using List iterator*/ public void printData(){ ListIterator itr=list.listIterator(); SuperMarket employee; while(itr.hasNext()){ employee=itr.next(); System.out.println("********************"); System.out.println("Employee Id: "+employee.getEmployeeId()+" "+"Employee Hourly Rate: "+employee.getHourlyRate()+" " +"Employee Regular Hour: "+employee.getRegularHour()+" " +"Employee Overtime Hour: "+employee.getOvertimeHour()+" " +"Employee gross pay: "+employee.getGrossPay()+" " +"Employee NetPay: "+employee.getNetpay()); } } /*Main method start*/ public static void main(String[] args) { SuperMarketDriver object=new SuperMarketDriver(); /*Calling readInput method*/ object.readInput(); /*Calling Print data method*/ object.printData(); } } /***************output************/ Please enter the number of Employees 2 Please Enter Employee Id
  • 9. 123 Please Enter Hourly Rate of Pay 200 Please Enter Number of regular hour 6 Please Enter overtime hours 3 Please Enter Employee Id 124 Please Enter Hourly Rate of Pay 400 Please Enter Number of regular hour 6 Please Enter overtime hours 2 ******************** Employee Id: 123 Employee Hourly Rate: 200.0 Employee Regular Hour: 6.0 Employee Overtime Hour: 3.0 Employee gross pay: 2100.0 Employee NetPay: 1460.0 ******************** Employee Id: 124 Employee Hourly Rate: 400.0 Employee Regular Hour: 6.0 Employee Overtime Hour: 2.0 Employee gross pay: 3600.0 Employee NetPay: 2510.0 Thanks