Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class weightsArray
- {
- public static void main (String args []){
- Scanner input = new Scanner (System.in);
- String [] namesArray = new String [5];
- int [] startWeightsArray = new int [5];
- int [] endWeightsArray = new int [5];
- int [] weightDifferenceArray = new int [5];
- String name;
- int startWeight;
- int endWeight;
- for (int x = 0; x<10;x++){
- System.out.println("Enter Name for person "+(x+1));
- name = input.next();
- namesArray[x]=name;
- System.out.println("Enter Start weight ");
- startWeight = input.nextInt();
- startWeightsArray[x]=startWeight;
- System.out.println("Enter End weight ");
- endWeight = input.nextInt();
- endWeightsArray[x]=endWeight;
- weightDifferenceArray[x]=startWeightsArray[x]-endWeightsArray[x];
- }
- for (int x=0;x<10; x++){
- System.out.println("Student Name: "+namesArray[x]+" Weight difference "+weightDifferenceArray[x]);
- }
- }
- }
Add Comment
Please, Sign In to add comment