Question

* Create a Single Java Class that contains two static methods that solve the specified problems on slides 3 and 4. Call the static methods with the parameters specified in the Task. ifu Submit as single java file Submit to Blackboard by 8AM on March sth. Assignment is worth 2 pts Cannot be late. . . Remember you should create/use helper methods to solve your problem rather than creating a single lengthy method. However, allhelper methods must be called from inside the method specified in the task.
media%2F6f5%2F6f52d92d-76c4-4dee-9956-48
media%2F7a4%2F7a4b701b-d803-4515-8cce-7c
media%2Faa4%2Faa452678-164f-4bf9-8e93-49
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Explanation:

Please find the below EastCoastSalesDevision class which contains quarterSalesReport (double[] tSales) and quarterCommissionReport (double[] tSales) methods. Also find the output of both the methods.

Please check and revert back in case anything needs to be changed.

Program:


public class EastCoastSalesDevision {
public static void main(String[] args) {
double[] tSales = {4.8, 5.7,6.6,7.5};
quarterSalesReport(tSales);
System.out.println();
quarterCommissionReport(tSales);
}
public static void quarterSalesReport (double[] tSales) {
System.out.printf("%-10s %-25s %-25s %-25s","Quarter","Total Sales","East Coast Sales","Other Sales");
System.out.println();
System.out.println("--------------------------------------------------------------------------------------------------");
for (int i=0;i<tSales.length;i++) {
double totalSales = tSales[i];
double eastCoastSales = (totalSales*60)/100;
double otherSales = totalSales - eastCoastSales;
System.out.printf("%-10s %-25s %-25s %-25s","Q"+String.valueOf(i+1),
String.valueOf(totalSales)+"m",String.valueOf(eastCoastSales)+"m",String.valueOf(otherSales)+"m");
System.out.println();
}
}
public static void quarterCommissionReport (double[] tSales) {
System.out.printf("%-10s %-25s %-25s %-25s","Quarter","Total Sales","East Coast Sales","Total Commision");
System.out.println();
System.out.println("--------------------------------------------------------------------------------------------------");
for (int i=0;i<tSales.length;i++) {
double totalSales = tSales[i];
double eastCoastSales = (totalSales*60)/100;
double commision = ((((totalSales*10)/100)*0.2)/100);
double totalCommision = commision*5*1000;
System.out.printf("%-10s %-25s %-25s %-25s","Q"+String.valueOf(i+1),
String.valueOf(totalSales)+"m",String.valueOf(eastCoastSales)+"m",String.valueOf(totalCommision)+"k");
System.out.println();
}
}
}

Output:

Quarter Total Sales East Coast Sales Other Sales   
--------------------------------------------------------------------------------------------------
Q1 4.8m 2.88m 1.92m   
Q2 5.7m 3.42m 2.2800000000000002m   
Q3 6.6m 3.96m 2.6399999999999997m   
Q4 7.5m 4.5m 3.0m

Quarter Total Sales East Coast Sales Total Commision   
--------------------------------------------------------------------------------------------------
Q1 4.8m 2.88m 4.800000000000001k
Q2 5.7m 3.42m 5.7k
Q3 6.6m 3.96m 6.6k
Q4 7.5m 4.5m 7.500000000000002k

double) tsales-4.,5.7,6.5,7.5 public static void qute5leskeport (dlell tSales Syster.out.printflX-12n System.out.pristin) ty

Add a comment
Know the answer?
Add Answer to:
* Create a Single Java Class that contains two static methods that solve the specified problems...
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
  • Create a class named Program10. Your program should have the following 4 methods (other helper methods...

    Create a class named Program10. Your program should have the following 4 methods (other helper methods are allowed, but these four methods must be implemented as specified). You need to define a global scanner object and only use it inside the main method and the getValues method, since other methods do not get any values from the input. getValues: This method does not have any input parameter and returns an array of integers. This method prompts the user with a...

  • This is for JAVA programming. Create a test class that contains two arrays and two methods:...

    This is for JAVA programming. Create a test class that contains two arrays and two methods: - The first array has 3 rows and 3 columns and is initialized with type double data - The second array has 4 rows and 4 columns and is also initialized with type double data - The first method ArraysRows will receive an array of type double as an argument and then print out the sum and average of all elements in each ROW....

  • Last name is Vhora 3. Write a java class named FinalyourLastName, which contains three methods: main,...

    Last name is Vhora 3. Write a java class named FinalyourLastName, which contains three methods: main, arrayMystery, and countTotalOdd. You need to create main method. Inside the main method...you need to create an integer array named myld that consists of each of the digits in your student ID, call arrayMystery method and print out myld, then call count TotaOdd method and print out the total number of odd digits in your ID. (8 points) The arrayMystery method is given as...

  • In Java All methods listed below must be public and static. If your code is using...

    In Java All methods listed below must be public and static. If your code is using a loop to modify or create a string, you need to use the StringBuilder class from the API. Keep the loops simple but also efficient. Remember that you want each loop to do only one "task" while also avoiding unnecessary traversals of the data. No additional methods are needed. However, you may write additional private helper methods, but you still need to have efficient...

  • pls help java ASAP!!!!!!! Topic String Tokenizer Static Methods Static Variables Primitive Arrays Description Enhance the...

    pls help java ASAP!!!!!!! Topic String Tokenizer Static Methods Static Variables Primitive Arrays Description Enhance the last assignment by providing the following additional features: (The additional features are listed in bold below) Class Statistics In the class Statistics, create the following static methods (in addition to the instance methods already provided). • A public static method for computing sorted data. • A public static method for computing min value. • A public static method for computing max value. • A...

  • I was presented with this problem: Create a Java class MonthNames with a single static method...

    I was presented with this problem: Create a Java class MonthNames with a single static method getMonthName which Takes a single integer corresponding to a month of the year, 1 representing January through 12 representing December, and Returns a string for the name of the month. This is what I have so far public class MonthNames {    public static String getMonthName (int numMonth) {        return "month"; }        public static void main (String [] args) {...

  • JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class....

    JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class. Print out the results after testing each of the methods in both of the classes and solving a simple problem with them. Task 1 – ArrayList Class Create an ArrayList class. This is a class that uses an internal array, but manipulates the array so that the array can be dynamically changed. This class should contain a default and overloaded constructor, where the default...

  • please use java application to solve methods: 5,6,10,12,13 (no need for the rest) Problem1: Create a...

    please use java application to solve methods: 5,6,10,12,13 (no need for the rest) Problem1: Create a new Java Application that has the following methods: 6 A method that generate a binary search tree (BST) where the number of nodes and the range of the values are 1. from a file. 2. A recursive method to print the BST in preorder traversal 3. A recursive method to print the BST in post-order traversal 4. A recursive method to print the BST...

  • JAVA I. Using the Event Class created previously, create an array of objects;        II. Demonstrate...

    JAVA I. Using the Event Class created previously, create an array of objects;        II. Demonstrate passing array reference to a method;        III. Demonstrate creating array of objects that prints out only x 0.0 for all objects. PROJECT 5C - ARRAYS Create a new file called " EventArray5C". There are some "challenging" directions in this project. . 1.Prepare a document box (tell me that task(s) the application is to accomplish, how it will accomplish the tasks, the author of...

  • Anyone helps me in a Java Languageif it it is possible thanks. Write a class called...

    Anyone helps me in a Java Languageif it it is possible thanks. Write a class called Player that holds the following information: Team Name (e.g., Ravens) . Player Name (e.g., Flacco) . Position's Name (e.g. Wide reciver) . Playing hours per week (e.g. 30 hours per week). Payment Rate (e.g., 46 per hour) . Number of Players in the Team (e.g. 80 players) . This information represents the class member variables. Declare all variables of Payer class as private except...

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