Objects & Arrays of Object References:

The Periodic Table Assignment

Example Transcript

Your program's output should be the same, but can differ in whitespace (i.e., it should look exactly identical to what's below, except for maybe an extra space, or a missing space).  User input is given in bold, with yellow highlight

Welcome to the Periodic Table Program!



Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
1
Atomic #:1
     Name:Hydrogen
     Symbol:H
     Atomic Weight:1.0008
Atomic #2: <Missing>
Atomic #3: <Missing>
Atomic #4: <Missing>
Atomic #5: <Missing>
Atomic #6: <Missing>
Atomic #7: <Missing>
Atomic #8: <Missing>
Atomic #9: <Missing>
Atomic #10: <Missing>
Atomic #11: <Missing>
Atomic #12: <Missing>
Atomic #13: <Missing>
Atomic #14: <Missing>
Atomic #15: <Missing>
Atomic #16: <Missing>
Atomic #17: <Missing>
Atomic #18: <Missing>
Atomic #19: <Missing>
Atomic #20: <Missing>
Atomic #21: <Missing>
Atomic #22: <Missing>
Atomic #23: <Missing>
Atomic #24: <Missing>
Atomic #25: <Missing>
Atomic #26: <Missing>
Atomic #:27
     Name:Cobalt
     Symbol:Co
     Atomic Weight:58.9332
     This element is a TRANSITION METAL
Atomic #28: <Missing>
Atomic #29: <Missing>
Atomic #30: <Missing>
Atomic #31: <Missing>
Atomic #32: <Missing>
Atomic #33: <Missing>
Atomic #34: <Missing>
Atomic #35: <Missing>
Atomic #36: <Missing>
Atomic #37: <Missing>
Atomic #38: <Missing>
Atomic #39: <Missing>
Atomic #40: <Missing>
Atomic #41: <Missing>
Atomic #42: <Missing>
Atomic #43: <Missing>
Atomic #44: <Missing>
Atomic #45: <Missing>
Atomic #46: <Missing>
Atomic #47: <Missing>
Atomic #48: <Missing>
Atomic #49: <Missing>
Atomic #50: <Missing>
Atomic #51: <Missing>
Atomic #52: <Missing>
Atomic #53: <Missing>
Atomic #54: <Missing>
Atomic #55: <Missing>
Atomic #56: <Missing>
Atomic #57: <Missing>
Atomic #58: <Missing>
Atomic #59: <Missing>
Atomic #60: <Missing>
Atomic #61: <Missing>
Atomic #62: <Missing>
Atomic #63: <Missing>
Atomic #64: <Missing>
Atomic #65: <Missing>
Atomic #66: <Missing>
Atomic #67: <Missing>
Atomic #68: <Missing>
Atomic #69: <Missing>
Atomic #70: <Missing>
Atomic #:71
Name:Lutetium
     Symbol:Lu
     Atomic Weight:174.96
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is a LANTHANIDE
Atomic #72: <Missing>
Atomic #73: <Missing>
Atomic #74: <Missing>
Atomic #75: <Missing>
Atomic #76: <Missing>
Atomic #77: <Missing>
Atomic #78: <Missing>
Atomic #79: <Missing>
Atomic #80: <Missing>
Atomic #81: <Missing>
Atomic #82: <Missing>
Atomic #83: <Missing>
Atomic #84: <Missing>
Atomic #85: <Missing>
Atomic #86: <Missing>
Atomic #87: <Missing>
Atomic #88: <Missing>
Atomic #89: <Missing>
Atomic #:90
     Name:Protactinium
     Symbol:Pa
     Atomic Weight:231.0359
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is an ACTINIDE
Atomic #91: <Missing>
Atomic #92: <Missing>
Atomic #93: <Missing>
Atomic #94: <Missing>
Atomic #95: <Missing>
Atomic #96: <Missing>
Atomic #97: <Missing>
Atomic #98: <Missing>
Atomic #99: <Missing>
Atomic #100: <Missing>
Atomic #101: <Missing>
Atomic #102: <Missing>
Atomic #103: <Missing>
Atomic #104: <Missing>
Atomic #105: <Missing>
Atomic #106: <Missing>
Atomic #107: <Missing>
Atomic #108: <Missing>
Atomic #109: <Missing>
Atomic #110: <Missing>
Atomic #111: <Missing>
Atomic #112: <Missing>
Atomic #113: <Missing>

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
2
What is the atomic number of the element you would like to print?
Valid atomic numbers range from 1 to 113
90
Atomic #:90
     Name:Protactinium
     Symbol:Pa
     Atomic Weight:231.0359
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is an ACTINIDE

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
2
What is the atomic number of the element you would like to print?
Valid atomic numbers range from 1 to 113
89
There is no data for that element!
Would you like to add it now? (type 'y' or 'Y' to do so!)
y
There is no data for that element, so you can add your own
What is the element's name?
Madeupium
What is the element's symbol?
Ma
What is the element's atomic weight?
9000
Element created!

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
2
What is the atomic number of the element you would like to print?
Valid atomic numbers range from 1 to 113
89
Atomic #:89
     Name:Madeupium
     Symbol:Ma
     Atomic Weight:9000

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
3
What is the atomic number of the element you would like to add?
Note that you can't replace an existing element
Valid atomic numbers range from 1 to 113
89
That element already has data (and you're not allowed to overwrite it!)
Atomic #:89
     Name:Madeupium
     Symbol:Ma
     Atomic Weight:9000

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
3
What is the atomic number of the element you would like to add?
Note that you can't replace an existing element
Valid atomic numbers range from 1 to 113
88
There is no data for that element, so you can add your own
What is the element's name?
Unobtainium
What is the element's symbol?
Un
What is the element's atomic weight?
3.4
Element created!

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
4
What is the atomic number of the element you would like to edit?
Valid atomic numbers range from 1 to 113
90
Here is the element's current info:
Atomic #:90
     Name:Protactinium
     Symbol:Pa
     Atomic Weight:231.0359
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is an ACTINIDE
What would you like the new name to be? (press enter on blank line to remain unc
hanged)
 
What would you like the new symbol to be? (press enter on blank line to remain u
nchanged)
Pr
What would you like the new weight to be?
232.0352
Here is the element's new info:
Atomic #:90
     Name:Protactinium
     Symbol:Pr
     Atomic Weight:232.0352
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is an ACTINIDE

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
4
What is the atomic number of the element you would like to edit?
Valid atomic numbers range from 1 to 113
3
There is no data for that element!
Would you like to add it now? (type 'y' or 'Y' to do so!)
n

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
4
What is the atomic number of the element you would like to edit?
Valid atomic numbers range from 1 to 113
3
There is no data for that element!
Would you like to add it now? (type 'y' or 'Y' to do so!)
y
There is no data for that element, so you can add your own
What is the element's name?
Outofnamesium
What is the element's symbol?
Ou
What is the element's atomic weight?
17.45
Element created!

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element
1
Atomic #:1
     Name:Hydrogen
     Symbol:H
     Atomic Weight:1.0008
Atomic #2: <Missing>
Atomic #:3
     Name:Outofnamesium
     Symbol:Ou
     Atomic Weight:17.45
Atomic #4: <Missing>
Atomic #5: <Missing>
Atomic #6: <Missing>
Atomic #7: <Missing>
Atomic #8: <Missing>
Atomic #9: <Missing>
Atomic #10: <Missing>
Atomic #11: <Missing>
Atomic #12: <Missing>
Atomic #13: <Missing>
Atomic #14: <Missing>
Atomic #15: <Missing>
Atomic #16: <Missing>
Atomic #17: <Missing>
Atomic #18: <Missing>
Atomic #19: <Missing>
Atomic #20: <Missing>
Atomic #21: <Missing>
Atomic #22: <Missing>
Atomic #23: <Missing>
Atomic #24: <Missing>
Atomic #25: <Missing>
Atomic #26: <Missing>
Atomic #:27
     Name:Cobalt
     Symbol:Co
     Atomic Weight:58.9332
     This element is a TRANSITION METAL
Atomic #28: <Missing>
Atomic #29: <Missing>
Atomic #30: <Missing>
Atomic #31: <Missing>
Atomic #32: <Missing>
Atomic #33: <Missing>
Atomic #34: <Missing>
Atomic #35: <Missing>
Atomic #36: <Missing>
Atomic #37: <Missing>
Atomic #38: <Missing>
Atomic #39: <Missing>
Atomic #40: <Missing>
Atomic #41: <Missing>
Atomic #42: <Missing>
Atomic #43: <Missing>
Atomic #44: <Missing>
Atomic #45: <Missing>
Atomic #46: <Missing>
Atomic #47: <Missing>
Atomic #48: <Missing>
Atomic #49: <Missing>
Atomic #50: <Missing>
Atomic #51: <Missing>
Atomic #52: <Missing>
Atomic #53: <Missing>
Atomic #54: <Missing>
Atomic #55: <Missing>
Atomic #56: <Missing>
Atomic #57: <Missing>
Atomic #58: <Missing>
Atomic #59: <Missing>
Atomic #60: <Missing>
Atomic #61: <Missing>
Atomic #62: <Missing>
Atomic #63: <Missing>
Atomic #64: <Missing>
Atomic #65: <Missing>
Atomic #66: <Missing>
Atomic #67: <Missing>
Atomic #68: <Missing>
Atomic #69: <Missing>
Atomic #70: <Missing>
Atomic #:71
     Name:Lutetium
     Symbol:Lu
     Atomic Weight:174.96
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is a LANTHANIDE
Atomic #72: <Missing>
Atomic #73: <Missing>
Atomic #74: <Missing>
Atomic #75: <Missing>
Atomic #76: <Missing>
Atomic #77: <Missing>
Atomic #78: <Missing>
Atomic #79: <Missing>
Atomic #80: <Missing>
Atomic #81: <Missing>
Atomic #82: <Missing>
Atomic #83: <Missing>
Atomic #84: <Missing>
Atomic #85: <Missing>
Atomic #86: <Missing>
Atomic #87: <Missing>
Atomic #:88
     Name:Unobtainium
     Symbol:Un
     Atomic Weight:3.4
Atomic #:89
     Name:Madeupium
     Symbol:Ma
     Atomic Weight:9000
Atomic #:90
     Name:Protactinium
     Symbol:Pr
     Atomic Weight:232.0352
     This element is an INNER TRANSITION METAL (aka RARE EARTH METAL)
     This element is an ACTINIDE
Atomic #91: <Missing>
Atomic #92: <Missing>
Atomic #93: <Missing>
Atomic #94: <Missing>
Atomic #95: <Missing>
Atomic #96: <Missing>
Atomic #97: <Missing>
Atomic #98: <Missing>
Atomic #99: <Missing>
Atomic #100: <Missing>
Atomic #101: <Missing>
Atomic #102: <Missing>
Atomic #103: <Missing>
Atomic #104: <Missing>
Atomic #105: <Missing>
Atomic #106: <Missing>
Atomic #107: <Missing>
Atomic #108: <Missing>
Atomic #109: <Missing>
Atomic #110: <Missing>
Atomic #111: <Missing>
Atomic #112: <Missing>
Atomic #113: <Missing>

Please select from the following menu of options:
0) Quit the program
1) Print all the elements
2) Print out a particular element
3) Add a new element
4) Edit an existing element

0

Thank you for using the Periodic Table Program!
(Please press the <Enter> key to exit)