This task is about classes and objects, and is solved in Python 3.
We will look at two different ways to represent a succession of monarchs, e.g. the series of Norwegian kings from Haakon VII to Harald V, and print it out like this:
King Haakon VII of Norway, accession: 1905
King Olav V of Norway, accession: 1957
King Harald V of Norway, accession: 1991
>>>
Make a class Monarch with three attributes: the name of the monarch, the nation and year of accession. The class should have a method write () which prints out the information on a line like in the example. It should also have the method _init_ (…), so that you can create a Monarch instance by name, nation and year of accession as arguments. Example:
haakon = Monarch("Norway","King Haakon VII",1905)
Here, the variable haakon will be assigned to the Monarch object for King Haakon VII. Now the series of kings can be represented in a variable series of kings, that contains a list of the three monarchs, in the right order. Finally, the program will print the series of kings as shown above.
In: Computer Science
When answering the following questions, explain the relationship to critical infrastructure protection.
Describe five of the 11 transportation infrastructure in terms of risk and protection - roads, railways, walkways, bridges and tunnels, stations, airports, air routes, waterways, ports, cycling infrastructure, and living streets.
In: Civil Engineering
which statements are true about Python functions?
a)Different functions cannot use same function name
b)a function always returns some value
c)different function cannot use the same variable names
d) function must use the same parameter names as the corresponding variables in the caller
what benefits does structuring a program through defining functions bring?
a) there is a possibility of reducing the number of variables and/or objects that must be managed at any cost at any one point
b)the program is easier to maintain
c)program with function executes faster
d)the program is easier to debug
in which scenario(s) should the sentinel value be set to -1 to terminate data entry
a)exam scores which can be negative but cannot be more than 100
b) participant name of participants who registered for a run
c)the rainfall data for days it rained
d)the weight of student waiting to undergo a medical examination.
suppose d = {"a": "apple", "b": "banana", "c": "cherry"}
which statement form a list [["a": "apple"], ["b": "banana"[, ["c": "cherry"]]
a) [[k,d[k]] for k in d.keys() ]
b) [[k,v] for k, v in d.items() ]
c) [[d,v] for v in d.values() ]
d) [[k,[0]], k[1]] for k in d]
In: Computer Science
Experiment 7: Thin Layer Chromatography
In: Other
1. If the demand for a good becomes less elastic without any change in the equilibrium price or quantity sold, consumer surplus in that market most likely
|
rises. |
||
|
falls. |
||
|
doesn't change, since price and quantity don't change. |
||
|
changes, but in a direction that cannot be determined. |
||
|
none of the above. |
2. Most of the marginal damage from US car travel in metropolitan areas is from
|
wear and tear of roads and bridges. |
||
|
pollution. |
||
|
congestion and reduced safety. |
||
|
another source. |
||
|
These marginal damages are all about equal, so none of them is the source of ``most" of the marginal damage. |
3. Most of the marginal damage from US semi truck travel (total travel) is from
|
wear and tear of roads and bridges. |
||
|
pollution. |
||
|
congestion and reduced safety. |
||
|
another source. |
||
|
These marginal damages are all about equal, so none of them is the source of ``most" of the marginal damage. |
In: Economics
Required Tasks:
Name: [Abdulmuhsin J.Al-Kandari], Email: [[email protected]], Major: [SE], GraduationYear: [2017]
Name: [Justin R. Schlemm], Email: [[email protected]], Major: [SE], GraduationYear: [2016]
Name: [Mary F. Menges], Email: [[email protected]], Major: [SE], GraduationYear: [2017]
Name: [Abdulmuhsin J.Al-Kandari], Email: [[email protected]], Major: [SE], GraduationYear: [2017]
Name: [Justin R. Schlemm], Email: [[email protected]], Major: [SE], GraduationYear: [2016]
Name: [Nicholas-Jason R. Roache], Email: [[email protected]], Major: [CS], GraduationYear: [2017]
Name: [Taylor J. Klodowski], Email: [[email protected]], Major: [SE], GraduationYear: [2016]
In: Computer Science
6) A solution of sodium chloride (molecular weight 58.5) is
electrolyzed and it is found that a
current of 1 A liberates 1.3 x 10-3 kg of chlorine (atomic weight
35.5) in one hour. Sodium
chloride crystals of density 2.17 x 103 kg/m3 are analyzed by x
rays and the unit cell parameter is
found to be 5.6 x 10-10 m. From these data calculate the charge on
a monovalent ion.
7) In a Milikan oil-drop experiment, a certain droplet was found to
fall freely in air at a steady rate
of 1.15 x 10-4 m/sec. between horizontal plates 3 mm apart. When an
electrical potential
difference of 400 V was applied between the plates, the droplet
rose steadily at 1.2 x 10-5 m/sec;
while at 300 V, the droplet fell steadily at 1.8 x 10-5 m/sec. Find
the magnitude of the charge on
the drop, given that the viscosity of the air is 1.8 x 10-5 mks
units, and the density of the oil used
was 900 kg/m3.
8) In an experiment to determine e/m for electrons by J. J.
Thomson’s method, the particles were
deflected by a uniform electrostatic field of 50000 V/m applied
between plates 0.05 m long. The
deflection produced on a screen placed 0.3 m away from the center
of the plates was 0.05 m.
This deflection was exactly canceled by applying a magnetic field
of 0.001 Tesla coextensive with
the electric field. Find the speed of the electrons, their specific
charge, and the accelerating
voltage.
In: Physics
Explain each of the following (in your own words):
a. The 3 fundamental rules of subprograms
b. Subprogram
c. Subprogram call
d. Subprogram Header
e. Parameter profile/Protocol
f. Formal Parameter–v-Actual Parameter
g. Procedure –v-Function
h. Design issues for subprograms
i. Stack dynamic –v-static variables
j. Parameter passing
i. In-mode
ii. Out-mode
iii. In-Out mode
1.Pass by result
2.Pass by reference
3.Pass by name
k. Design issues for parameter passing
l. Overloaded subprogram
m. Generic subprogram
n. Design issues for functions
In: Computer Science
Checking Input File for correct line format.
So for my C++ assignment, my professor says we need to validate the Input File, if there are white lines and spaces, in which it will ignore them, separated by a comma, and that all data items are there. This will be used in a program where i will store these into an Array, and display them in First name, Last name, and Number of Votes vertical columned categories.
This is a sample of the txt file. My question is, What do i use to be able to take only the names and number and place them into an array. Please explain what each line is doing, even it is not completely obvious. I am a complete beginner.
F=Michael,L=John,V=3342
F=Danny,L=Red,V=2003
F=Hillary,L=Clinton, V=1588
F=Albert,L=Lee,V=5332
F=Steven,L=JohnV=4429
Correct line for the reference: F=John,L=Smith,V=3342
The line errors that your program needs to detect, are as follows:
incorrect token / separator, example in line 5: F=Steven,L=JohnV=4429
(comma missing) – lines with this error need to be ignored
space in token, example in line 3: F=Hillary,X=Clinton, V=1622
lines with this error need to be read, error fixed, data included in your dataset
empty line, example in line 6 – empty lines need to be ignored
This is the sample of the getline code we are suppose to use.
void readFile(Candidate candidates[]) {
string line;
ifstream infile;
infile.open("elections.txt");
while (!infile.eof()) {
getline(infile,line);
// your code here
}
infile.close();
}
In: Computer Science
PSY 235 Child Development: Pre-Lab Work Sheet
Name______________________________ Class and Section _PSY 235 -___________
Instructor’s Name ____________________
(TO BE COMPLETED IN CLASS)
Prior to coming to the lab: Define each of the following and give an example. You may use your book, but be sure to use your own words and use complete sentences. Be sure to bring this worksheet with you to the lab.
PSY 235 Adult Development: Pre-Lab Work Sheet
Name______________________________ Class and Section _PSY 235 -___________
Instructor’s Name ____________________
(TO BE COMPLETED IN CLASS)
Prior to coming to the lab: Define each of the following stages of Erikson’s theory of psychosocial development. You may use your book, but be sure to use your own words and use complete sentences. Be sure to bring this worksheet with you to the lab.
PSY 235 Adult Development: Pre-Lab Work Sheet
Name______________________________ Class and Section _PSY 235 -___________
Instructor’s Name ____________________
(TO BE COMPLETED IN CLASS)
Prior to coming to the lab: Define each of the following stages of Erikson’s theory of psychosocial development. You may use your book, but be sure to use your own words and use complete sentences. Be sure to bring this worksheet with you to the lab.
PSY 235 Adult Development: Pre-Lab Work Sheet
Name______________________________ Class and Section _PSY 235 -___________
Instructor’s Name ____________________
(TO BE COMPLETED IN CLASS)
Prior to coming to the lab: Define each of the following stages of Erikson’s theory of psychosocial development. You may use your book, but be sure to use your own words and use complete sentences. Be sure to bring this worksheet with you to the lab.
In: Psychology