Advertisement
SageScroll18144

DLP.java

Nov 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3. import java.util.Scanner;
  4. public class DLP{
  5.     public static void main(String[] args){
  6.         ArrayList<Character> nameSB = new ArrayList<>(Arrays.asList(new Character[]{'s', 'p', 'd', 'f'}));
  7.         int[] valueSB = {2,6,10,14};
  8.         String paulling = "1s2s2p3s3p4s3d4p5s4d5p6s4f5d6p7s5f6d7p";
  9.        
  10.         System.out.println("digite o número Z do átomo.:");
  11.  
  12.         Scanner s = new Scanner(System.in);
  13.  
  14.         int z = s.nextInt();
  15.         System.out.println("Sub-níveis.:\tElétrons.:");
  16.         while(z > 0){
  17.            
  18.             for(int i = 0; i<paulling.length(); i+=2){
  19.                 int subnivel = valueSB[nameSB.indexOf(paulling.charAt(i+1))];
  20.                 System.out.print(paulling.charAt(i)+""+paulling.charAt(i+1) + "  \t\t");
  21.                 if(z > subnivel){
  22.                     z-=subnivel;
  23.                     System.out.println(subnivel);
  24.                 }
  25.                 else{
  26.                     System.out.println(z);
  27.                 }
  28.             }
  29.         }
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement