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

Advanced Java Programming with Object-Oriented Programming Design VERY IMPORTANT

ID: 3733760 • Letter: A

Question

Advanced Java Programming with Object-Oriented Programming Design

VERY IMPORTANT NOTE!!: This program for the question below MUST USE at least 2 CLASSES, getters/setters, etc and other object-oriented design (OOD) concepts because I'm in a more advanced Java class that requires me to utilize the concepts mentioned above. Also, I need detailed, but brief comments to most, if not all of the code to explain what is being used in the code and what is does so I have a better understanding of the code. I've seen answers to the question below already posted, however they don't utilize object-oriented design (OOD) concepts such as a minumum of two classes, getters/setters, etc which is required for this advanced Java programming class. So please......answer the question and meet the requirements for this question. Basically, I need advanced Java object-oriented design concepts for simple programs so here's to hoping this works out and if it does, I'll give a thumbs up, I promise!!!

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, or a total of $650. Write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson’s salary is truncated to an integer amount):

a) $200–299

b) $300–399

c) $400–499

d) $500–599

e) $600–699

f) $700–799

g) $800–899

h) $900–999

i) $1,000 and over

Summarize the results in tabular format.

Explanation / Answer

import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.println("Enter total number of sales people in the company:");
int n = in.nextInt();
Company company = new Company(n);
for(int i=0;i<n;i++){
SalesPeople salesPeople = new SalesPeople();
System.out.println("Enter total sales of Employee no "+(i+1)+":");
int sales = in.nextInt();
salesPeople.setTotalSales(sales);
salesPeople.calculateSalary();
company.addSalesPeople(salesPeople);
}
company.printCategoryCount();
}
}
class SalesPeople{
private int totalSales; //stores total sales
private int salary;
//getters and setters
void setTotalSales(int totalSales){
this.totalSales = totalSales;
}
int getTotalSales(){
return totalSales;
}
void setSalary(int salary){
this.salary = salary;
}
int getSalary(){
return salary;
}
void calculateSalary(){//calculates salary
salary=(int)(200+(9*totalSales/100));
}
}
class Company{
private int categoryCounter[]=new int[9];
private SalesPeople salesPeople[]; //array for storing salespeople detail
private int n; //total number of sales people in the company
private int pos;
Company(int n){ // constructor. n is the number of sales people in the company
this.n = n;
salesPeople = new SalesPeople[n];
}
SalesPeople getSalesPeople(int i){
return salesPeople[i];
}
void addSalesPeople(SalesPeople salesPeople){
this.salesPeople[pos]=salesPeople;
int x = (salesPeople.getSalary()/100)-2;
if(x>=8){
categoryCounter[8]++;
}
else{
categoryCounter[x]++;
}
}
void printCategoryCount(){
System.out.println("Category Count ");
for(int i=0;i<8;i++){
System.out.println("$"+(i*100+200)+" - "+(i*100+299)+": "+categoryCounter[i]);
}
System.out.println("$1000 and above: "+categoryCounter[8]);
}
  
}

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