Question

PART2 - Requirement Create the project SP2019LAB4_yourLastName Add one data type class named Representative_yourLastname ANDCOMPANY KITCHEN PRODUCTS 123 Buckingham Dallas, TX 75243 Sale Prepresentative: Pay Date: Work count: James Smith 02/26/2019 5

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Representative.java

public class Representative {
   // Data members
   private String name;
   private String id;
   private int workCount;
   private float saleAmount;
  
   // Parameterized constructor to initialize data members
   public Representative(String name, String id, int workCount, float saleAmount) {
       this.name = name;
       this.id = id;
       this.workCount = workCount;
       this.saleAmount = saleAmount;
   }
  
   // Setter and getter method for data members
   public String getName() {
       return name;
   }
   public void setName(String name) {
       this.name = name;
   }
   public String getId() {
       return id;
   }
   public void setId(String id) {
       this.id = id;
   }
   public int getWorkCount() {
       return workCount;
   }
   public void setWorkCount(int workCount) {
       this.workCount = workCount;
   }
   public float getSaleAmount() {
       return saleAmount;
   }
   public void setSaleAmount(float saleAmount) {
       this.saleAmount = saleAmount;
   }
  
   // Calculate and return base salary
   public double getBaseSalary() {
       return 22*workCount;
   }
  
   // Calculate and return commission based on given conditions
   public double getCommission() {
       double commission = 0;
       if(saleAmount>=12000) {
           commission = 5.5*saleAmount/100;
       }else if(saleAmount>10000 && saleAmount<12000) {
           commission = 3.5*saleAmount/100;
       }else if(saleAmount<=10000 && saleAmount>0) {
           commission = 3.5*saleAmount/100;
       }
       return commission;
   }
  
   // Calculate and return bonus
   public double getBonus() {
       if(saleAmount>10000) {
           return 2.5*(saleAmount-10000)/100;
       }
       return 0;
   }
  
   // Add base, commission and bonus and return salary
   public double getSalary() {
       return getBaseSalary()+getBonus()+getCommission();
   }
  
   // This method return result in string format
   public String toString() {
       return "Base Salary: "+String.format("%.2f",getBaseSalary())+
               "\nCommission: "+String.format("%.2f",getCommission())+
               "\nBonus: "+String.format("%.2f",getBonus())+
               "\nSalary: "+String.format("%.2f",getSalary());
   }
}

MonthlySalarySlip.java

import java.util.Scanner;

public class MonthlySalarySlip {

   public static void main(String[] args) {
       System.out.println("..........................................");
       System.out.println("COMPANY KITCHEN PRODUCTS\n123 Buckingham Dallas, TX 75243");
      
       // Scanner class object to take user input
       Scanner scan = new Scanner(System.in);
      
       // Ask user to input name, id, workcount and saleamount
       System.out.print("Sale Prepresentative: ");
       String name = scan.nextLine();
       System.out.print("Employee id: ");
       String id = scan.nextLine();
       System.out.print("Work Count: ");
       int workCount = Integer.parseInt(scan.nextLine());
       System.out.print("Sale amount: ");
       float saleAmount = Float.parseFloat(scan.nextLine());
      
       // Create object of Representative and pass these values
       Representative r = new Representative(name,id,workCount,saleAmount);
       System.out.println("..........................................");
      
       // Print result
       System.out.println(r);
   }
}

L Problems @JavadOC岛Declaration A/Search 도 Console <terminated> MonthlySalarySlip [Java Application] C:Prograrm COMPANY KITCH

<terminated> MonthlySalarySlip Java Application] C:Prog COMPANY KITCHEN PRODUCTS 123 Buckingham Dallas, TX 75243 Sale Prepres

<terminated> MonthlySalarySlip [ava Application] C:Progr COMPANY KITCHEN PRODUCTS 123 Buckingham Dallas, TX 75243 Sale Prepre

NOTE - Date was nowhere mentioned in the question, instead there was a requirement to input employee id

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
PART2 - Requirement Create the project SP2019LAB4_yourLastName Add one data type class named Representative_yourLastname AND a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (Java) Please include one data type class and one driver class in the program. Please also...

    (Java) Please include one data type class and one driver class in the program. Please also include a UML diagram and pseudocode. B. REQUIREMENT STATEMENT THIS LAB REQUIRES OBJECT ORIENTED PROGRAMMING. YOU HAVE TO CREATE ONE DATA TYPE CLASS AND ONE DRIVER CLASS (include main) One company request an application that allows users to READ from the keyboard the information of a vendor: name (String), id (String), sale amount in the month (double) then calculate the salary of vendors based...

  • In Java: DATA TYPE CLASS Create one data type class Account_yourLastName that hold the information of...

    In Java: DATA TYPE CLASS Create one data type class Account_yourLastName that hold the information of an account such as accountNumber (String), name (String), address (String), balance (float), interestRate(float) and beside the no-argument constructor, parameterized constructor, the class has method openNewAccount, method checkCurrentBalance, method deposit, method withdrawal, method changeInterestRate REQUIREMENT - DRIVER CLASS Provide the application for the Bank Service that first displays the following menu to allow users to select one task to work on. After finishing one task,...

  • Objectives – to practice these new concepts: decision-making with if, if-else, if-else-if-… switch data validation for...

    Objectives – to practice these new concepts: decision-making with if, if-else, if-else-if-… switch data validation for user input using a while (or while/do) loop nicely formatted output report with printf and format strings multiple input data sets using a while (or while/do) loop named constants PROJECT OVERVIEW This project provides a detailed payroll report for the sales staff at TheLaptopShop. The company has 3 tiers of salespeople: low, middle, high (designated by L, M, H) – based on their past...

  • Create a java class Customer.java that will represent a water company customer. It should contain the...

    Create a java class Customer.java that will represent a water company customer. It should contain the attributes, constructors, and methods listed below, and when finished should be able to allow the included file TestWaterBills.java to work correctly. Customer class Attributes firstName: String type, initial value null lastName: String type, initial value null streetAddress: String type, initial value null city: String type, initial value null state: String type, initial value null zip: String type, initial value null previousMeterReading: int type, initial...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • eBook Show Me How Calculator Margin of Safety a. If Canace Company, with a break-even point...

    eBook Show Me How Calculator Margin of Safety a. If Canace Company, with a break-even point at $369,200 of sales, has actual sales of $520,000, what is the margin of safety expressed (1) in dollars and (2) as a percentage of sales? Round the percentage to the nearest whole number 1. $ 2. % b. If the margin of safety for Canace Company was 25%, fixed costs were $1,496,250, and variable costs were 75% of sales, what was the amount...

  • On April 20, 2001, Yan Fangjiao, general manager of the Instruments Division of Stone Group Corp....

    On April 20, 2001, Yan Fangjiao, general manager of the Instruments Division of Stone Group Corp. in Beijing, China, received a phone call from Lu Feng, sales representative of the Instruments Division. Feng was calling to ask Yan whether he should sell three Model HP34401A digital multimeters from the Instruments Division to the Industrial Controllers Division and what transfer price should be used if he did want to sell. Yan had to consider the appropriate accounting principles that applied in...

  • Team Conflict In a rare moment alone in her office, Jennifer Ames reflected on the past...

    Team Conflict In a rare moment alone in her office, Jennifer Ames reflected on the past 10 years of her career at BabyProduct Corporation (BPC). She could easily chart her successes: She had taken on challenges and produced results where her colleagues had failed; she had increased the diversity of the work force in every unit she had led; she had successfully launched new products and developed several new markets. In fact, just a few months before, Ames had been...

  • Problem: Rockford Corporation is a wholesale plumbing supply distributor. The corporation was organized in 1981, under...

    Problem: Rockford Corporation is a wholesale plumbing supply distributor. The corporation was organized in 1981, under the laws of the State of Illinois, with an authorized capitalization of 10,000 shares of no-par common stock with a stated value of $30 per share. The common stock is sold over the counter in the local area. You have been hired as of Friday, December 26, 2014, to replace the controller, who has resigned. As controller, you are responsible for the corporation’s accounting...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT