Help With an Array
// ********************
// Sales.java
//
// Reads in and stores sales for each of 5 salespeople. Displays
// sales entered by salesperson id and total sales for all salespeople.
//
// ********************
import java.util.Scanner;
public class Sales
{
public static void main(String[] args)
{
final int SALESPEOPLE = 5;
int[] sales = new int[SALESPEOPLE];
int sum;
int salesPerson=-1;
int salesPerson1 = -1;
int number;
int x;
Scanner scan = new Scanner(System.in);
for (int i=0; i
{
System.out.print("Enter sales for salesperson " + (i+1) + ": ");
sales[i] = scan.nextInt();
}
System.out.println("\nSalesperson Sales");
System.out.println("--------------------");
sum = 0;
for (int i=0; i
{
System.out.println(" " + (i+1) + " " + sales[i]);
sum += sales[i];
}
System.out.println("\nTotal sales: " + "$" + sum);
int average= sum/5;
System.out.println("Average Sale:" + " " + "$" + average);
System.out.println();
int max = sales[0];
for (int i=0; i < sales.length; i++)
{if (sales[i]>max){
max = sales[i];
salesPerson = i;}
}
System.out.println("Salesperson " + (salesPerson + 1) + " had the highest sale with :" + max);
int min = 100000;
for (int i=0; i < sales.length; i++)
{if (sales[i]
min = sales[i];
salesPerson1 = i;
}
}
System.out.println("Salesperson " + (salesPerson1 + 1) + " had the lowest sale with :" +
min);
{
System.out.print("Enter a number: " );
number[x] = scan.nextInt();
for (int x=0; x < number; x++)
{if (number[x] < )
}
}
}
OK, So heres my problem, someone is supposed to enter a number towards the end of this code and the output should show the "salesperson" id tags that fell below that number. The number of the input should represent the "sales" of the "salesperson." I realize that the bottom part of the code:
System.out.print("Enter a number: " );
number[x] = scan.nextInt();
for (int x=0; x < number; x++)
{if (number[x] < )
is wrong but I need help from this part on. I need that part corrected and add a portion that would ask the user to input a number, return the "salesperson" id tag's that exceed that number along with their "sales" and also the total number of "salesperson"'s that exceeded that number. Any help I would greatly appreciate. Thank you
View Answers
Related Tutorials/Questions & Answers:
HELP WITH ARRAYHELP WITH ARRAY Hi i would like this program:
public class ArrayApp... that the user input didn't match match with the number in the
array boxes.. the output should be "Invalid Input"
if it matches the number in the
array boxes
Help With an ArrayHelp With an Array So what Im trying to do is write an
array... trying to do is almost combine the two to create a larger
array declaration... not figure out how to finish the code. Please
HELP!
A) students? names
Advertisements
Help With an ArrayHelp With an Array // ********************
// Sales.java
//
// Reads...] < )
is wrong but I need
help from this part on. I need that part corrected... number of "salesperson"'s that exceeded that number. Any
help I would greatly
Netbeans Array helpNetbeans
Array help Ok here is my code-
*
* To change this template...
array to tally the actual combinations of rolls. A roll of 2 and 7 would... of rolls possible within the arrayADS_TO_REPLACE_1
Help plese!
Hi Friend
Need help in constructing a 2 dimensionla array?Need
help in constructing a 2 dimensionla
array? Construct a 2 dimensional
array that for each entry in the
array, display the index of the first...
array.
import java.util.*;
public class twoDimension{
public static void main
please help me to solve this question about arrayplease
help me to solve this question about array write a program thatt stores vowels (a,e,i,o and u)in an
array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
Create a int array with the help of int buffer.Create a int
array with the
help of int buffer.
In this tutorial, we will see how to create a int
array with the
help of
int buffer.
IntBuffer API...;
float[]
array()
The
array() method returns int
array based
is _array()is _
array() is_
array() in php
Hi Friend,
This function is of Boolean type.It checks whether a variable is an
array or not.
Here is an example:
<?php
$yes =
array('Hello', 'World');
echo is_
array($yes) ? '
Array is _array()is _
array() is _
array()
Hi Friend,
This function is of Boolean type.It checks whether a variable is an
array or not.
Here is an example:
<?php
$yes =
array('Hello', 'World');
echo is_
array($yes) ? '
Array Array'sArray's I have to finish an "order page". that checks 2 dropdown... line at a time, then calculate a total. I know I need to create an
array, but I'm having a hard time figuring out the loop. I just need a little
help to get
helphelp i need
help with this code.
write a java code for a method named addSevenToKthElement that takes an integer
array, and an integer k as its arguments and returns the kth element plus 7.
any
help would be greatly
ArrayArray how can i use elements of an
array in a circular form? that is if the searching of the element reach the last elements of the
array, then it will start serching from the begining of the
array ArrayArray is it possible to define
array like this..?
int[] intArray = new int[] {4,5,6,7,8}; Explain...?
Yes, you can.
Java Initialize
Array ArrayArray What if i will not declare the limit index of an
array, how will I declare an
array and store values with it using loop?
Hi Friend... Scanner(System.in);
int
array[]=new int[5];
System.out.println("Enter
arrayarray write and test a function named mirror that is passed an
array of n floats and returns a newly created
array that contains those n floats... the
array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
arrayarray write and test a function named mirror that is passed an
array of n floats and returns a newly created
array that contains those n floats... the
array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
arrayarray write and test a function named mirror that is passed an
array of n floats and returns a newly created
array that contains those n floats... the
array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
ArrayArray How do i insert elements into an
array up to a limit from...("Enter Range: ");
int size=input.nextInt();
int
array[]=new int[size];
System.out.println("Enter
Array Elements: ");
for(int i=0;i<
arrayarray WAP in java to store 6 element in
array P and
4 element in
array Q. Produce the third arra
y R containing all element from p &
q Java Array declarationJava
Array declaration
In this section you will learn how to declare
array in java. As we know an
array is collection of single type or similar data type. When an
array is
created its length is determined. An
array can hold fixed
ArrayArray can we create an
array of size 1 lakh in java programming
arrayarray
array memory allocation is dynamic or static in java
Java Arrays have dynamic memory allocation
arrayarray create an
array in which no element is duplicate.
if duplicate then tell to user duplicate.
duplicacy is tell to user during when he enter the element
arrayarray create an
array in which no element is duplicate.
if duplicate then tell to user duplicate.
duplicacy is tell to user during when he enter the element
arrayarray take a 2d
array and display all its elements in a matrix fome using only one for loop and ple explain the program in below
array accepts a pointer to integer which represents an
array of integer.After that this method prints the entire of the
array numbers to the monitor.
include
using std::cout;
using std::endl;
void printArray(int *
array, int count
arrayarray How to store the results of mysql query in an
array... qurey in
array: "select distinct(EMPLID)from tblwork where EMPLID not in (select... store the result in
array PHP Array TypePHP
Array Types:
In PHP an
array is more than just
array, it is an ordered map... it as an
array, list or vector, hash table, etc.
In associative
array a key may... will be truncated as integer. ADS_TO_REPLACE_1
Following examples will
help you to learn
PHP ArrayArray in PHP
Almost every language supports
array, which is a collection.... An
array could
be a collection of similar or dissimilar datatype.
PHP
Array Example 1:ADS_TO_REPLACE_1
<?php
echo"An
array with similar
helphelp i can't answer this question....state 2 different
array processing which use loops
arrayarray wap to calculate reverse of 10 elements in an
array?
...();
}
System.out.print("
Array is: ");
for(int i=0;i<arr.length;i...();
System.out.print("After reversing,
Array is: ");
for(int i=arr.length-1;i>=0
arrayarray Hi
i have
array like {1,2,3,4,,5,5,6,6} then how can i... is an example that store some integers into an
array and find the occurrence of each number from the
array.
import java.util.*;
public class SearchNumberOccurrence
arrayarray how to getting values and storing values in
array by using datainputstream?
Hi Friend,
Try the following code:ADS_TO_REPLACE_1...("
Array Elements are: ");
for(int i=0;i<arr.length;i
Array reserved.
Use a one-dimensional
array of primitive type Boolean to represent the seating chart of the cinema theater. Initialize all the elements of the
array... the corresponding elements of the
array to true to indicate that the seat is no longer
help help how i can send a pitcture on url in java
helphelp pls
help me to get the code of a java program
a program to perform different shapes in a menu using javaapplet
ARRAYARRAY CAN SOMEONE
HELP ANSWER THIS QUESTION PLEASE
Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output
ARRAYARRAY CAN SOMEONE
HELP ANSWER THIS QUESTION PLEASE
Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output
HELPHELP I need this code to open in a new web browser. but no matter what i do it wont please
help??
Directive 055 Storage Requirements for the Upstream Petroleum Industry
Help...Help... Write a class that displays your first name vertically down the screen
â?? where each letter uses up to 5 rows by 5 columns of a character input
by you with a blank line between each letter
Help Help i have a html file.. i have take input and store in database .. Tell me the steps to perform.. i have xampp it includes mysql,tomacat,apache. and how display the data from datbase ..
please explain
JavaScript array unique
JavaScript
array unique
In this Tutorial we want to describe a code that
help you in understanding
array unique. The program uses JavaScript as scripting language
Help!Help! thanks for ur code, I'd like to ask a question:
after press "c" or "C", timer starts and after every delay ms, it'll print "This line is printed only once." or just print once. I'm writting a timer but it seems to perform