#introduction to JAVA task!
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
Of course! I'd be happy to help you with your Java task. Please provide the details of the task, and I'll guide you through the solution step by step.
introduction to JAVA task!
hiya !
it's better to copy/paste the text
so we can highlight important keywords like this
For the purpose of a software for keeping track of the revenue generated by employees in the sales department, define a QuarterlySales class that stores the number of sales, the revenue generated by each sale and the number of the quarter.
Then define another SalesPerson class for which a name(string) and an array of quarterly sales (exactly 4) are stored. For the classes implement the appropriate constructors and methods for the correct execution of the program.
Implement the following requirements:
• Method int sumSales(SalesPerson sp)* which will return sum of all the revenues in all quarters generated by the given worker.
• Method 'SalesPerson salesChampion(SalesPerson I arr)* which for the given array of sales employees will return the worker with the most generated revenue (of all quarters)
• Add the 'main' method, which will initialize an array of sales persons and quarters according to the input test cases. The number of sales employees is read from input in the first line, and then for each employee the name is read in the first line, and then for each of the quarters for that employee in the first line we have the number of sales, and then in the next line the revenue generated by each of those sales.
• On standard output, print the array of sales employees using the method void table(SalesPerson I arr)*, which will print a display for the array of sales persons in the following format (three spaces are used for printing space):

would you like to simplify it a bit ?
can you ?
cuz im busy at work rn
and can't read the hell of this
First you start creating all the classes
Then declare the methoss
Do that and keep trying until u run into an issue
import java.util.Scanner;
class QuarterlySales {
private int numOfSales;
private int [] revenues;
private int quarterNo;
public QuarterlySales(int numOfSales, int[] revenues, int quarterNo) {
this.numOfSales = numOfSales;
this.revenues = revenues;
this.quarterNo = quarterNo;
}
@Override
public String toString() {
}
}
class SalesPerson {
private String name;
private QuarterlySales [] quarters;
public SalesPerson(String name, QuarterlySales[] quarters) {
this.name = name;
this.quarters = quarters;
}
@Override
public String toString() {
}
}
public class Main {
public static SalesPerson salesChampion(SalesPerson [] arr)
{
}
public static void table(SalesPerson [] arr)
{
}
public static void main(String[] args) {
int n;
Scanner input = new Scanner(System.in);
n = input.nextInt();
SalesPerson [] arr = new SalesPerson[n];
for(int i=0;i<n;i++)
{
//your code goes here
}
table(arr);
System.out.println("SALES CHAMPION: " + salesChampion(arr).getName());
}
}
im trying too much but i dont really get this one, its a lil bit difficult for me :/
I mean after you read that description
Can you just tell us what u understand, and what u didnt or difficult to you!
I see you made some code thts good
Based on the description of the problem, it seems you're facing an object oriented (OO) topic
exactly
You need to understand it by identifying keywords potential to be classes
actually now I've solved it all but there is only one problem left which i cant really understand what should i do
What is it
When you declare a class as public in a java file
It must have same name as the file
Which one?
all of them
You have a file "SalesPerson"
btw this is a task from my school which i solve directly in my school website
Right?
yes
Inside you have a class Main right?
yes
yes
Read what i told u
i just tried
If the class is only needed inside that file or in the package where that file, it could be without public like this:
class Main{}
okay
And do the same with QuaterlySales