- Joined
- Feb 24, 2012
- Sythe Gold
- 273
- Messages
- 4,216
im in csc 111 and forgot that i have a lab due soon and i m pretty fucked. this is literally basic shit like arrays. if anyone can help me out super quick i will suck ur dick and throw u some bills. pm me if u can help or post here. this is the first prompt so u understand what it's gonna be like:
Part 1. You will be given two separate arrays which contain information about each sales team working for a company – the team names are in one array named teamsArray and the sales generated by each team are in the second array named salesArray.
teamsArray: [ ATL | NYC | CHI | SOCAL | MIA | SLC ]
salesArray: [ 422150.00 | 1125200.00 | 315686.00 | 654390.00 | 522879.00 | 987653.00 ]
You should assume that sales values are doubles.
Your task is to report the city abbreviations and sales for teams that had at least $500,000.00 in sales.
For the data above, the expected solution is:
NYC: $1125200.00
SOCAL: $654390.00
MIA: $522879.00
SLC: $987653.00
NOTE: In order to print the dollar values with two decimal places you'll need to use an alternative to System.out.println() named System.out.format() as follows:
System.out.format( "%s: $%.2f\n", teamsArray, salesArray );
Part 2. If no sales team meets the $500,000.00 threshold, your program should print a message that reads:
No teams met expectations. Might want to sell your stock.
In this case the output would read as follows:
Sales teams meeting expectations:
No teams met expectations. Might want to sell your stock.
Part 1. You will be given two separate arrays which contain information about each sales team working for a company – the team names are in one array named teamsArray and the sales generated by each team are in the second array named salesArray.
teamsArray: [ ATL | NYC | CHI | SOCAL | MIA | SLC ]
salesArray: [ 422150.00 | 1125200.00 | 315686.00 | 654390.00 | 522879.00 | 987653.00 ]
You should assume that sales values are doubles.
Your task is to report the city abbreviations and sales for teams that had at least $500,000.00 in sales.
For the data above, the expected solution is:
NYC: $1125200.00
SOCAL: $654390.00
MIA: $522879.00
SLC: $987653.00
NOTE: In order to print the dollar values with two decimal places you'll need to use an alternative to System.out.println() named System.out.format() as follows:
System.out.format( "%s: $%.2f\n", teamsArray, salesArray );
Part 2. If no sales team meets the $500,000.00 threshold, your program should print a message that reads:
No teams met expectations. Might want to sell your stock.
In this case the output would read as follows:
Sales teams meeting expectations:
No teams met expectations. Might want to sell your stock.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int i;
int numberOfTeams;
String[] teamsArray;
double[] salesArray;
// THIS CODE UP TO THE ---- READS IN THE TEAM AND SALES INFORMATION
Scanner scnr = new Scanner(System.in);
numberOfTeams = scnr.nextInt();
teamsArray = new String[numberOfTeams];
salesArray = new double[numberOfTeams];
for (i = 0; i < numberOfTeams; ++i) {
teamsArray = scnr.next();
salesArray = scnr.nextDouble();
}
// ----
// STUDENT CODE SHOULD GO HERE
}
}
public class Main {
public static void main(String[] args) {
int i;
int numberOfTeams;
String[] teamsArray;
double[] salesArray;
// THIS CODE UP TO THE ---- READS IN THE TEAM AND SALES INFORMATION
Scanner scnr = new Scanner(System.in);
numberOfTeams = scnr.nextInt();
teamsArray = new String[numberOfTeams];
salesArray = new double[numberOfTeams];
for (i = 0; i < numberOfTeams; ++i) {
teamsArray = scnr.next();
salesArray = scnr.nextDouble();
}
// ----
// STUDENT CODE SHOULD GO HERE
}
}































































