Home Answers Viewqa Java-Beginners Help With an Array

 
 


Michael
Help With an Array
0 Answer(s)      2 years and 6 months ago
Posted in : Java Beginners

So what Im trying to do is write an array declaration to represent students names for a class and homework grades for each student. I have included my arrays for a declaration for 25 students names in a class and also a declaration for students tests grades in a class of 40. Now what I am trying to do is almost combine the two to create a larger array declaration. The declaration size does not have to be big, I only included 5 names but I can not figure out how to finish the code. Please HELP!

A) students? names for a class of 25 students

import java.util.Scanner;

public class Student

{

public static void main (String[] args)

{

Scanner scan = new Scanner (System.in);

String[] names = new String [15];

System.out.println ("Class Size : " + names.length);

for (int index = 0; index < names.length; index++)

{System.out.print ("Enter student " + (index+1) + " name :");

names[index] = scan.next();

}

System.out.println("Your student's are:");

for (int index = names.length-1; index>=0; index--)

System.out.print (names[index] + " ");

}

}

B) students? test grades for a class of 40 students

import java.util.Scanner;

public class Student

{

public static void main(String[] args)

{

final int STUDENTS = 40;

int[] grades = new int[STUDENTS];

Scanner scan = new Scanner(System.in);

for (int i=0; i

{

System.out.print("Enter grades for student " + (i+1) + ": ");

grades[i] = scan.nextInt();

}

System.out.println("\nStudent?s Grades");

System.out.println("--------------------");

for (int index = grades.length-1; index>=0; index--)

  System.out.print (grades[index] + " ");

}

}

C) students? names for a class and homework grades for each student

public class Student

{

public static void main (String[] args)

{

String[] names = new String [] {"Jim", "Bobby", "Shawn", "Michael", "George"};

System.out.println ("Class Size : " + names.length);

int[] grades = new int [] {80, 85, 90, 95, 100};

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

  grades[i];

}

  {

System.out.println("Your student's grades are:");

for (int index = names.length-1; index>=0; index--)

System.out.print (names[index] + " " + grades[i]);

}

}

}

View Answers









Related Pages:
HELP WITH ARRAY
HELP 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 Array
Help 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
Help With an Array
Help With an Array  // ******************** // Sales.java // // Reads... need help from this part on. I need that part corrected and add a portion..."'s that exceeded that number. Any help I would greatly appreciate. Thank you
Array's
Array'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
help
help  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
help
help  i can't answer this question....state 2 different array processing which use loops
ARRAY
ARRAY  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
ARRAY
ARRAY  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
Netbeans Array help
of rolls possible within the array Help plese!   Hi Friend, Try...Netbeans 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
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
Regular Expression Help Help HELP!!!!
Regular Expression Help Help HELP!!!!  HI all I am very new to java...['07001'].CO = new Array("MR","","Harish Ram","Not Available","M.R Harish... could help me to give a solution of how to retrieve the name and email add
please help me to solve this question about array
please 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...[] array() The array() method returns int array based on int buffer
How to create a long array with the help of long buffer.
How to create a long array with the help of long buffer.  In this tutorial, we will see how to create a long array with the help of long buffer...; long[] array() The array() method returns long array based
PHP Array
Array 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: <?php echo"An array with similar datatype"
Array in C
Array in C  Respected Sir, How can an array be an lvalue, if we can't assign to it? How can I set an array's size at run time? How can I avoid fixed-sized arrays? help me sir
Create a short array with the help of short buffer.
Create a short array with the help of short buffer.  In this tutorial, we will see how to create a short array with the help of short buffer...; short[] array() The array() method returns short array based
Array search
Array search  Need a program which performs a searching operation on a one dimensional array called NUM, which is an N-element array stored in a file... for the search operation. he value with one or more of the array items. Search begins
Array Strings
Array Strings  String auto[]=new String[]{"Length: ","Breadth... is a single dimensional array. How do you do this with a two dimensional array...: "}{"Length: ","Breadth: ","Height: "}; the above code generates error. please help
ARRAY TUTORIAL
ARRAY TUTORIAL  PLEASE HELP ME ANSWER THESE ARRAY TUTORIAL Q1- It is easy to write outsides the bounds of a String or an array in Java: True or False? If false, explain why. Q2 - In Java, you must declare an array before you
ARRAY TUTORIAL
ARRAY TUTORIAL  PLEASE HELP ME ANSWER THESE ARRAY TUTORIAL Q1- It is easy to write outsides the bounds of a String or an array in Java: True or False? If false, explain why. Q2 - In Java, you must declare an array before you
help in java
help in java  Write an application that prompt the user to enter a number to use as an array size, and then attempt to declare an array using... an array with a negative size, and a NumberFormatException if you atempt
Array in Java
Array in Java  public class tn { public class State{ String s_name; int p1; int p2; } public void f... t = new tn(); tn.f(); } Can anyone help me in 2 comment line
java help?
java help?  Write a program, where you first ask values to an array... (send in the array & return the counted value to the main program). Print...) { int array[]=new int[6]; Scanner input=new Scanner(System.in
Generating Random Numbers to Fill array. Java Beginner needing help!
Generating Random Numbers to Fill array. Java Beginner needing help!  ... methods: // Displays the array permutatedNumbers to the console public void... the permutated array public void generatePermutation(){} Make an array to hold
Collection to Array
Collection to Array      ...; a collection into a array. In this example we creating an object of ArrayList, adding... elements of ArrayList into an array by using toArray(). List 
Array List
Array List  Could somebody help me to solve this question. I am glad to hear ideas or answers from everyone. The situation: Complete the class House and HouseApp below to display class House{ int lotNo; String type
help me
help me  I have a quastion a bout array whic is>>> 1-write aprogram to diplay a multiplication table for 1to 10 by entering the start number and the end number. EXAMPLE: ENTER START NUMBER:1 ENTER END NUMBER:3
Problem in Array
Problem in Array  Hi, Can you help me with this problem? Run a program that check if the input string contains equal number of A's and B's. Hoping... you so much for quick response.very big help
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
array_merge null - PHP
array_merge null   i am using the array_merge and getting the unusual null error...any help
array, index, string
array, index, string  how can i make dictionary using array...please help
cannot find symbol class array queue--plzz somebody help..
cannot find symbol class array queue--plzz somebody help..  import java.util.*; public class Test { public static void main(String[] args) { ArrayQueue<String> q = new ArrayQueue<String>(6); System.out.println
PHP Array Type
will be truncated as integer. Following examples will help you to learn array quickly...PHP 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
Array Sizeof Function PHP
Array Sizeof Function PHP  Hi, How to count the number of elements in an array using the PHP Array sizeof() function? Please provides me online help links or example of array sizedof() PHP. Thanks
plese help
plese help  i need a program to convert a decimal num into binary num in java language by using array and loop   Java Convert decimal to binary import java.util.*; public class DecimalToBinary{ public static void
java help
java help   Write a Java program that does the following: 1.Creates a grading program based on the Baker College grading standard. You will need... the +/- signs. A = 93-100 etc. Uses a char array to hold the letter grades
help please?
help please?  Define a class named Circle with the following... an array of THREE (3) Circle objects based on the Circle class definition... the objects to the first two elements of the array. Finally, use another loop
Need help with this!
Need help with this!  Can anyone please help me... to a file at all at this time. Any help would be greatly appreciated, thank you... the entrys in array score = -1 for later error checking. for(arrayCounter = 0
boolean help
to do with the for loop? Please help import java.io.BufferedReader; import... in the array. What u have to do is to place a break statement at this point
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
java array problem
java array problem  suppose i have an array a[] at a[0] i have value 5,7 the thing is that i want to assign the value of array a[0]=5,7 to two variable let it be j,k that is j=5 and k=7 plz help regards
Array /string based problem....
Array /string based problem....  thanx to help me.but again a problem... or char"); char[] array = new char[5]; for(int i=0;i<5;i++){ char ch=input.next().charAt(0); array[i]=ch; } selectionSort(array); for(int i = 0; i <
string array based problem
string array based problem  R/sir, firstly thanks to help me so much. but now it can sort string very well but in case of integers... string: "); String[] array = new String[5]; for(int i=0;i<5;i++){ array[i
Array Sorting - Development process
Array Sorting  Hello sir, Now i m doing various Array sorting(Bubble,insertion,Quick,merge etc ) I want to display Array Sort in steps by step like... is the code to display array sorting with moving graphics(color)in steps
array_merge null - PHP
array_merge null   i am using the array_merge and getting the unusual null error...any help?  Hi Friend, Please visit the following links: http://www.roseindia.net/tutorial/php/phpbasics/PHP-Array-Merge
Array sorting - Java Beginners
" array also gets sorted automatically depending on the "name" array. Any help...Array sorting   Hello All. I need to sort one array based on the arrangement of another array. I fetch two arrays from somewhere
ARRAY - Java Beginners
ARRAY  How To Find Out Unique Elements Of Given Array... Plz Help Me?  Hi Friend, Try the following code: import...) { int array[]={1,2,1,1,3,4,4,3,6,8,0,6,0,3}; int num; int count; for(int i = 0
JavaScript array of arrays
JavaScript array of arrays       In this Tutorial we want to describe you a code that help you in understanding JavaScript array of arrays. For this we are using JavaScript

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.