Write a program to get the electron
configuration, given the atomic number. Assume that
elements atomic numbers are between 1 to 118. Any programming
language is fine but Java or Python is preferred.
class ElectronConfiguration
{ public static void main(String
s[])
{
int atomicNumber =
20;
String
electronConfiguration =
getElectronConfiguration(atomicNumber);
System.out.println(electronConfiguration);
}
public static String getElectronConfiguration(int atomicNumber)
{
String result = null;
//Write code here to get the electronic configuration
return result;
}
}
public class ElectronConfiguration
{
public static void main(String s[]) {
int atomicNumber = 20;
String electronConfiguration =
getElectronConfiguration(atomicNumber);
System.out.println(electronConfiguration);
}
public static String getElectronConfiguration(int
atomicNumber) {
String arr[] = {"", "1S1", "1S2",
"[He]2s1", "[He]2s2", "[He]2s22p1", "[He]2s22p2", "[He]2s22p3",
"[He]2s22p4",
"[He]2s22p5", "[He]2s22p6", "[Ne]3s1",
"[Ne]3s2", "[Ne]3s23p1", "[Ne]3s23p2", "[Ne]3s23p3",
"[Ne]3s23p4", "[Ne]3s23p5", "[Ne]3s23p6",
"[Ar]4s1", "[Ar]4s2", "[Ar]3d14s2", "[Ar]3d24s2",
"[Ar]3d34s2", "[Ar]3d54s1", "[Ar]3d54s2",
"[Ar]3d64s2", "[Ar]3d74s2", "[Ar]3d84s2", "[Ar]3d104s1",
"[Ar]3d104s2", "[Ar]3d104s24p1",
"[Ar]3d104s24p2", "[Ar]3d104s24p3", "[Ar]3d104s24p4",
"[Ar]3d104s24p5",
"[Ar]3d104s24p6", "[Kr]5s1", "[Kr]5s2",
"[Kr]4d15s2", "[Kr]4d25s2", "[Kr]4d45s1", "[Kr]4d55s1",
"[Kr]4d55s2", "[Kr]4d75s1", "[Kr]4d85s1",
"[Kr]4d10", "[Kr]4d105s1", "[Kr]4d105s2", "[Kr]4d105s25p1",
"[Kr]4d105s25p2", "[Kr]4d105s25p3",
"[Kr]4d105s25p4", "[Kr]4d105s25p5", "[Kr]4d105s25p6",
"[Xe]6s1",
"[Xe]6s2", "[Xe]5d16s2", "[Xe]4f15d16s2",
"[Xe]4f36s2", "[Xe]4f46s2", "[Xe]4f56s2", "[Xe]4f66s2",
"[Xe]4f76s2", "[Xe]4f75d16s2", "[Xe]4f96s2",
"[Xe]4f106s2", "[Xe]4f116s2", "[Xe]4f126s2", "[Xe]4f136s2",
"[Xe]4f146s2", "[Xe]4f145d16s2",
"[Xe]4f145d26s2", "[Xe]4f145d36s2", "[Xe]4f145d46s2",
"[Xe]4f145d56s2",
"[Xe]4f145d66s2", "[Xe]4f145d76s2",
"[Xe]4f145d96s1", "[Xe]4f145d106s1", "[Xe]4f145d106s2",
"[Xe]4f145d106s26p1", "[Xe]4f145d106s26p2",
"[Xe]4f145d106s26p3", "[Xe]4f145d106s26p4",
"[Xe]4f145d106s26p5", "[Xe]4f145d106s26p6",
"[Rn]7s1", "[Rn]7s2", "[Rn]6d17s2", "[Rn]6d27s2",
"[Rn]5f26d17s2", "[Rn]5f36d17s2",
"[Rn]5f46d17s2", "[Rn]5f67s2", "[Rn]5f77s2", "[Rn]5f76d17s2",
"[Rn]5f97s2", "[Rn]5f107s2", "[Rn]5f117s2",
"[Rn]5f127s2", "[Rn]5f137s2", "[Rn]5f147s2",
"[Rn]5f147s27p1", "[Rn]5f146d27s2",
"*[Rn]5f146d37s2", "*[Rn]5f146d47s2", "*[Rn]5f146d57s2",
"*[Rn]5f146d67s2", "*[Rn]5f146d77s2",
"*[Rn]5f146d97s1", "*[Rn]5f146d107s1", "*[Rn]5f146d107s2",
"*[Rn]5f146d107s27p1", "*[Rn]5f146d107s27p2",
"*[Rn]5f146d107s27p3", "*[Rn]5f146d107s27p4",
"*[Rn]5f146d107s27p5", "*[Rn]5f146d107s27p6"
};
String result = arr[atomicNumber];
//Write code here to get the electronic configuration
return result;
}
}
![<terminated > ElectronConfiguration Java Applica [Ar]4s2](http://img.homeworklib.com/questions/d24fafd0-31ef-11eb-8c38-e364c2497992.png?x-oss-process=image/resize,w_560)
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Write a program to get the electron configuration, given the atomic number. Assume that elements atomic...
Problem 1 Given a linked list of integers, write a function getUnique that removes all duplicates elements in the linked list and returns the new linked list of unique elements (The order does not matter). Example: Input: 1-»2->3->1-2 Output: 1->2->3 public class Node f int iterm Node next; Node(int d) t item = d; next-null; ) import java.util.ArrayList; public class ExtraLab public static void main (String[] args)t PROBLEM 1 System.out.println("PROBLEM 1"); Node head new Node(1); head.next-new Node (2); head.next.next-new Node(3);...
JAVA HELP: Directions Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. Here is my code, I am having a problem with the second method. import java.util.Scanner; import java.util.Random; public class ArrayBackwards { public static void main(String[] args) { genrate(); print(); } public static void generate() { Scanner scanner = new Scanner(System.in); System.out.println("Seed:"); int seed = scanner.nextInt(); System.out.println("Length"); int length = scanner.nextInt(); Random random...
write a program to handle an exception that is generated when a program attempts to write beyond the end of an array in a lower scope such that that the exception is handled at a higher scope. java please write simple code so I can understand. use the code below public class Main { public static void main(String [] args) { int [] values = {1,2,3,4}; try { int theSum= calculate_sum(values); } catch (expection arrayindexoutofBoundsexpection) { //System.out.println(“tired to access array...
Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA MAIN import java.util.StringTokenizer; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE); String name = thedata; Student pupil = new Student(name); //add code here ...
Write a program that will check a Java file for syntax errors. The program will ask for an input-file name and output-file name and will then copy all the code from the Java input file to the Java output file, but with the following changes: 1. Any syntax error found in the Java input file will be corrected: a. Missing semicolon b. Missing compound statements (curly braces) c. All comments have to start with // and end with a period....
Java BNF How to write pseudocode for this snippet? Java code for finding a prime number public class Prime { public static void main(String[] args) { int num = 29; boolean flag = false; for(int i = 2; i <= num/2; ++i) { // condition for nonprime number if(num % i == 0) { flag = true; break; } } if (!flag) System.out.println(num + " is a prime number."); else System.out.println(num + " is not a prime number."); } }
1) Consider the following Java program: 1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...
Write the example code to describe overloading and submit here. You need to put comments for your code. You need to add at least one more overloaded method to the example code. public class OverloadingExample { public static void main(String[] args) { OverloadingExample t = new OverloadingExample(); t.methodX(5,9,2.2); t.methodX(5,9,"Hi"); t.methodX(5,9,2); t.methodX(5,9); } public void methodX(int a){ System.out.println("This is the method X with 1 parameters!"); } public void methodX(int a,int b){ System.out.println("This is the method X with 2 parameters!"); } public...
JAVA PROGRAMMING Given main(), complete the SongNode class to include the printSongInfo() method. Then write the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the dummy head node. Ex: If the input is: Stomp! 380 The Brothers Johnson The Dude 337 Quincy Jones You Don't Own Me 151 Lesley Gore -1 the output is: LIST OF SONGS ------------- Title: Stomp! Length: 380 Artist: The Brothers Johnson Title: The Dude Length: 337 Artist: Quincy Jones...
JAVA CODE This program causes an error and crashes. Compile and give it a test run, note the exception that is thrown. Then do the following to fix the problem 1. Write code to handle this exception 2. Use try, catch and finally blocks. 3. Display, the name of the exception 4. Display a message from the user about what happened. Here is the starting file BadArray.java: public class BadArray { public static void main(String[] args) { // Create an...