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

Completed this programming assignment with a friend but we want to avoid plagari

ID: 3865311 • Letter: C

Question

Completed this programming assignment with a friend but we want to avoid plagarism. Please help me modify our code.It should look different but similar. It should also produce the same output.

import java.util.Scanner;

public class Store {
  
   private String location;
   private String manager;
   private double quarterlySales[];
   private double projectedSales;
   private Scanner keybd = new Scanner(System.in);

   //empty construtor
   public Store(){
       location = "";
       manager = "";
       quarterlySales = new double[4];
   }
   //overloaded constructor
   public Store(String loc, String mgr){
       location = loc;
       manager = mgr;
       quarterlySales = new double[4];
   }
  
  
   public void setStoreLctn(int i) {
       System.out.print(" Enter the location for store " + i + ": ");
       location = keybd.nextLine().trim();
   }

   public void setManager(int i) {
       System.out.print("Enter the name of the manager for store " + i + ": ");
       manager = keybd.nextLine().trim();
   }

   public void setTotalQtrlySales(int i) {
       String quarter = "" ;
      
       for(int q = 1; q <= 4; q++){
           if(q == 1)
               quarter = "1st";
           else if(q == 2)
               quarter = "2nd";
           else if(q == 3)
               quarter = "3rd";
           else if(q == 4)
               quarter = "4th";
           System.out.print("Enter the sales revenue for the " + quarter + " quarter of store " + i +": " );
           quarterlySales[q-1] = keybd.nextDouble();
          
       }
       System.out.print("What is the projected annual sales for store " + i + "? ");
       projectedSales = keybd.nextDouble();
   }
  
   public String getStoreLctn(){
       return location;
   }
  
   public String getStoreManager(){
       return manager;
   }
  
   public double getProjectedAnnualSales(){
       return projectedSales;
   }
  
   public double getTotalQuarterlySales(){
       double total = 0;
       for(int i = 0; i < 4; i++)
           total += quarterlySales[i];
      
       return total;
   }
}

CompanyStores.java

import java.util.Scanner;

public class CompanyStores {
   private Scanner keybd = new Scanner(System.in);
   private String companyName; //name of the company
   private Store[] myStores; //stores
   //empty constructor
   public CompanyStores(){
      
   }
  
   public void start(){
       String answer;
       System.out.print("Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': ");
       answer = keybd.nextLine().trim().toUpperCase();
       if(answer.equals("Y")){
           processStoreInfo();
           displayStoreStats();
       }
       else{
           System.out.println("Thank you! Exiting program.");
       }
   }
  
   private void processStoreInfo(){
       System.out.print("What is the name of your company? ");
       companyName = keybd.nextLine().trim().toUpperCase();
       System.out.print("How many stores do you have? ");
       int n = keybd.nextInt();
       myStores = new Store[n];
       for(int i = 0; i < n; i++)
       {
           myStores[i] = new Store();
           myStores[i].setStoreLctn(i+1);
           myStores[i].setManager(i+1);
           myStores[i].setTotalQtrlySales(i+1);      
       }
   }
  
   private void displayStoreStats(){
       String message, report = "";
       double salesDifference;
      
       report += " SALES FOR " + companyName + " AT ALL LOCATIONS ";
       for(int i = 0; i < myStores.length; i++){
           report += " Store: " + companyName + " @ " + myStores[i].getStoreLctn() + " ";
           report += "Manager: " + myStores[i].getStoreManager() + " ";
           report += "Projected Annual Sales: $" +String.format("%,.2f", myStores[i].getProjectedAnnualSales()) + " ";
           report += "Total Quarterly Sales: $" +String.format("%,.2f", myStores[i].getTotalQuarterlySales()) + " ";
           salesDifference = myStores[i].getTotalQuarterlySales() - myStores[i].getProjectedAnnualSales();
           report += "Difference: $" +String.format("%,.2f", salesDifference) + " ";
           if(salesDifference >= 0){  
               report += "Performance: KEEP UP THE GOOD WORK! Your store is ahead of your annual sales ";
               report += "projections or right on target. ";
           }
           else{
               report += "Performance: WARNING! Your store sales are below annual projections. ";
           }
       }
      
       System.out.println(report);
   }
}

Main.java


public class Main {
  
   public static void main(String[] args) {
       CompanyStores company = new CompanyStores();
       company.start();
   }
}

Here is what the output should look like.

SAMPLE OUTPUT*: It is always good to test your code using sample data to see if y program meets the output specifications. Check to make sure your ouiput matches the sample output in spacing, line advances,and wording. I not, make the necessa correction(s box at the end of your PA4 .java file that has the main). The comment box needs to be outside of the close brace for the class. Worth 5 ) in your code and re-run the output Copy and paste the output into a comm OUTPUT WHEN RESPONSE IS 'N' NOT PART OF OUTPUT Do you want to track the sales performance of your store(s)? Enter 'Y or 'N: n Thank you! Exiting program OUTPUT WHEN RESPONSE IS ‘Y' NOT PART OF OUTPUT Do you want to track the sales performance of your store(s)? Enter 'Y" or 'N': y What is the name of your company? tandem How many stores do you have? 2 Enter the location for store 1: DeZavala & 110 Enter the name of the manager for store 1: Carmen Vasquez Enter the sales revenue for the 1st quarter of store 1: 25000

Explanation / Answer

import java.util.Scanner;

public class Store {

private String location;

private String manager;

private double quarterlySales[];

private double projectedSales;

private Scanner keybd = new Scanner(System.in);

// empty construtor

public Store() {

location = "";

manager = "";

quarterlySales = new double[4];

}

// overloaded constructor

public Store(String loc, String mgr) {

location = loc;

manager = mgr;

quarterlySales = new double[4];

}

public void setStoreLctn(int i) {

System.out.print(" Enter the location for store " + i + ": ");

location = keybd.nextLine().trim();

}

public void setManager(int i) {

System.out.print("Enter the name of the manager for store " + i + ": ");

manager = keybd.nextLine().trim();

}

public void setTotalQtrlySales(int i) {

String quarter = "";

for (int q = 1; q <= 4; q++) {

if (q == 1)

quarter = "1st";

else if (q == 2)

quarter = "2nd";

else if (q == 3)

quarter = "3rd";

else if (q == 4)

quarter = "4th";

System.out.print("Enter the sales revenue for the " + quarter

+ " quarter of store " + i + ": ");

quarterlySales[q - 1] = keybd.nextDouble();

}

System.out.print("What is the projected annual sales for store " + i

+ "? ");

projectedSales = keybd.nextDouble();

}

public String getStoreLctn() {

return location;

}

public String getStoreManager() {

return manager;

}

public double getProjectedAnnualSales() {

return projectedSales;

}

public double getTotalQuarterlySales() {

double total = 0;

for (int i = 0; i < 4; i++)

total += quarterlySales[i];

return total;

}

}

import java.util.Scanner;

public class CompanyStores {

private Scanner keybd = new Scanner(System.in);

private String companyName; // name of the company

private Store[] myStores; // stores

// empty constructor

public CompanyStores() {

}

public void start() {

String answer;

System.out

.print("Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': ");

answer = keybd.nextLine().trim().toUpperCase();

if (answer.equals("Y")) {

processStoreInfo();

displayStoreStats();

} else {

System.out.println("Thank you! Exiting program.");

}

}

private void processStoreInfo() {

System.out.print("What is the name of your company? ");

companyName = keybd.nextLine().trim().toUpperCase();

System.out.print("How many stores do you have? ");

int n = keybd.nextInt();

myStores = new Store[n];

for (int i = 0; i < n; i++) {

myStores[i] = new Store();

myStores[i].setStoreLctn(i + 1);

myStores[i].setManager(i + 1);

myStores[i].setTotalQtrlySales(i + 1);

}

}

private void displayStoreStats() {

String message, report = "";

double salesDifference;

report += " SALES FOR " + companyName + " AT ALL LOCATIONS ";

for (int i = 0; i < myStores.length; i++) {

report += " Store: " + companyName + " @ "

+ myStores[i].getStoreLctn() + " ";

report += "Manager: " + myStores[i].getStoreManager() + " ";

report += "Projected Annual Sales: $"

+ String.format("%,.2f",

myStores[i].getProjectedAnnualSales()) + " ";

report += "Total Quarterly Sales: $"

+ String.format("%,.2f",

myStores[i].getTotalQuarterlySales()) + " ";

salesDifference = myStores[i].getTotalQuarterlySales()

- myStores[i].getProjectedAnnualSales();

report += "Difference: $" + String.format("%,.2f", salesDifference)

+ " ";

if (salesDifference >= 0) {

report += "Performance: KEEP UP THE GOOD WORK! Your store is ahead of your annual sales ";

report += "projections or right on target. ";

} else {

report += "Performance: WARNING! Your store sales are below annual projections. ";

}

}

System.out.println(report);

}

}

public class Main {

public static void main(String[] args) {

CompanyStores company = new CompanyStores();

company.start();

}

}

OUTPUT:

Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': n
Thank you! Exiting program.

Do you want to track the sales performance of your store(s)? Enter 'Y' or 'N': y
What is the name of your company? tandem
How many stores do you have? 2

Enter the location for store 1: tandem1
Enter the name of the manager for store 1: carmen
Enter the sales revenue for the 1st quarter of store 1: 25000
Enter the sales revenue for the 2nd quarter of store 1: 28000
Enter the sales revenue for the 3rd quarter of store 1: 29000
Enter the sales revenue for the 4th quarter of store 1: 30000
What is the projected annual sales for store 1? 100000

Enter the location for store 2: tandem2 201
Enter the name of the manager for store 2: Garza
Enter the sales revenue for the 1st quarter of store 2: 30000
Enter the sales revenue for the 2nd quarter of store 2: 25000
Enter the sales revenue for the 3rd quarter of store 2: 28000
Enter the sales revenue for the 4th quarter of store 2: 35000
What is the projected annual sales for store 2? 125000

SALES FOR TANDEM AT ALL LOCATIONS

Store: TANDEM @ tandem1
Manager: carmen
Projected Annual Sales: $100,000.00
Total Quarterly Sales: $112,000.00
Difference: $12,000.00
Performance: KEEP UP THE GOOD WORK! Your store is ahead of your annual sales
projections or right on target.

Store: TANDEM @ tandem2 201
Manager: Garza
Projected Annual Sales: $125,000.00
Total Quarterly Sales: $118,000.00
Difference: $-7,000.00
Performance: WARNING! Your store sales are below annual projections.

NOTE: Please check the output that matches the given output, if you want anything please comment that i can help or please give spec to change the code then i can change accordingly.

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