Michael Wittry has been investing in his Roth IRA retirement account for 19 years. Five years
ago his 5account was worth $1215, 658. After losing 1/3 of its original value it then gained 1/2
of its new value back What is the current value of his Roth IRA? (Do not round intermediate
calculations.)
Solution
original worth : $215,658
lost : 1/3*original value
= (1/3)*$215,658
= $71,886
new value = $215,658 - $71,886 = $143,772
gained = 1/2 * new value
= (1/2)*$143,772
= $71,886
current value = $143,772 + $71,886 = $215,658
Answer: $215,658.
Monitoring System As a zookeeper, is important to it know the activi.pdf
1. Monitoring System As a zookeeper, is important to it know the activities of the animals in your
care and to monitor their living habitats. Create a monitoring system that does all of the
following: Asks a user if they want to monitor an animal, monitor a habitat, or exit Displays a list
of animal options (based on the previous selection) as read from either the animals or habitats
file o Asks the user to enter one of the options Displays the monitoring information by finding
the appropriate section in the file Separates sections by the category and selection (such as
"Animal Lion" or "Habitat-Penguin Uses a dialog box to alert the zookeeper ifthe monitor
detects something out of the normal range (These will be denoted in the files by a new line
starting with Do not display the asterisks in the dialog.) Allows a user to return to the original
options Details on lions Details on penguin habitat Details on bird house Details on tigers Details
on aquarium Details on bears Details on giraffes Habitat Penguin Animal Lion Temperature:
Freezing Food source Fish in water running low Name: Leo Cleanliness Passed Age: 5 Health
concerns Cut on left front paw Habitat Bird Feeding schedule: Twice daily Temperature:
Moderate Food source: Natural from environment Animal Tiger Cleanliness Passed Name: Ma
Age: 15 Health concerns None Habitat Aquarium Temperature: Varies with output temperature
Feeding schedule 3x daily Food source: Added daily Cleanliness Needs cleaning from algae
Animal Bear Name: Baloo Age: 1 Health concerns None Feeding schedule: None on record
Animal Giraffe Name: Spots Age 12 Health concerns: None Feeding schedule Grazing
Below was the inital answer, can someone assist in transcribing thsi into "code"?
1. FileReader with BufferedReader and FileWriter with PrintWriter can be used for file I/O , line
wise . Each line with several Strings also called as token can be separated using split() on blank
space while retrieval .
2. End of file is denoted by -1 . The file can be iterated till the desired token is obtained , using a
while loop . eg. b can be a boolean variable intialized to true ,eg. while(b) . once the token is
obtained the b can be set to false .
3. To gather Information and display to the user , the token for choice can be searched and
corresponding data can be appended to StringBuilder token wise , till token for next category
starts or end of file and displayed using toString() method .eg. ***** is also a token or word
string which can be gathered into an String array , by split() method on each line extracted using
readLine() . Token comparison is done with isEquals("")
4. For User Menu Options , Scanner can be used for user input along with getString etc. and
switch case construct can be used for processing of user choice from menu . System.out.print()
for display to user messages .
5. To allow user to the previous option another super while loop can be used within which the
other looops done so that user can be presented the original options again . Monitoring System
2. As a zookeeper, it is important to know the activities of the animals in your care and to monitor
their living habitats. Create a monitoring system that does all of the following: Asks a user if
they want to monitor an animal, monitor a habitat, or exit Displays a list of anima options (based
on the previous selection) as read from either the animals or habitats file o Asks the user to enter
one of the options Displays the monitoring information by finding the appropriate section in the
file Separates sections by the category and selection (such as "Animal Lion" or "Habitat
Penguin Uses a dialog box to alert the zookeeper if the monitor detects something out ofthe
normal range (These will be denoted in the files by a new line starting with Do not display the
asterisks in the dialog Allows a user to return to the original options Details on penguin habitat
Details on lions Details on bird house Details on tigers Details on bears Details on aquarium
Details on giraffes Habitat Penguin Animal Lion Temperature: Freezing Food source: Fish in
water running low Name Leo Cleanliness: Passed Age: 5 """""Health concerns: cut on left
front paw Habitat Bird Feeding schedule: Twice daily Temperature: Moderate Food source:
Natural from environment Animal Tige Cleanliness: Passed Name: Maj Age: 15 Health concerns
None Habitat Aquarium Temperature: Varies with output temperature Feeding schedule: 3x
daily Food source: Added daily Cleanliness Needs cleaning from algae Animal Bear Name:
Baloo Age: 1 Health concerns None Feeding schedule None on record Animal Giraffe Name:
Spots Age: 12 Health concerns: None Feeding schedule Grazing
Solution
Psudocode for the given problem.
While(true):
print "Enter 1 to monitor Animal"
print "Enter 2 to monitor habitat"
print "Enter 3 exit"
option = int(raw_input())
if(option = 1):
print "Enter 1 for details on lion"
print "Enter 2 for details on tiger"
print "Enter 3 for details on bears"
print "Enter 3 for details on giraphes"
option = int(raw_input())
if(option == 1):
Read_info_of_lions();
display_info_of_lions();
3. elif(option == 2):
Read_info_of_tigers();
display_info_of_tigers();
elif(option == 3):
Read_info_of_bears();
display_info_of_bears();
elif(option == 4):
Read_info_of_giraffes();
display_info_of_giraffes();
print "Enter 1 To go to main menu and 2 to exit!"
option = int(raw_input())
if(option == 1):
continue()
else:
exit()
elif(option == 2):
print "Enter 1 for details on penguin habitat"
print "Enter 2 for details on bird house"
print "Enter 3 for details on aquarium"
option = int(raw_input())
if(option == 1):
Read_info_of_penguins();
display_info_of_penguins();
elif(option == 2):
Read_info_of_bird_house();
display_info_of_bird_house();
elif(option == 3):
Read_info_of_aquarium();
display_info_of_aquarium();
print "Enter 1 To go to main menu and 2 to exit!"
option = int(raw_input())
if(option == 1):
continue()
else:
exit()
else: