IN C++!!
Exercise #2: Design and implement class Radio to represent a radio object. The class defines the following attributes (variables) and methods:
Assume that the station and volume settings range from 1 to 10.
The radio station is X and the volume level is Y. Where X and Y are the values of variables station and volume. If the radio is off, the message is: The radio is off.
Now design and implement a test program to create a default radio object and test all class methods on the object in random order. Print the object after each method call and use meaningful label for each method call as shown in the following sample run.
Sample run:
Turn radio on:
The radio station is 1 and the volume level is 1.
Turn volume up by 3:
The radio station is 1 and the volume level is 4.
Move station up by 5:
The radio station is 6 and the volume level is 4.
Turn volume down by 1:
The radio station is 6 and the volume level is 3.
Move station up by 3:
The radio station is 9 and the volume level is 3.
Turn radio off.
The radio is off.
Turn volume up by 2: The radio is off.
Turn station down by 2: The radio is off.
In: Computer Science
Hydrogen and methanol have both been proposed as alternatives to hydrocarbon fuels.
A) Write balanced reactions for the complete combustion of hydrogen.
B) Use standard enthalpies of formation to calculate the amount of heat released per kilogram of the fuel.
C) Write balanced reactions for the complete combustion of methanol.
D) Use standard enthalpies of formation to calculate the amount of heat released per kilogram of the fuel.
E) How does the energy of these fuels compare to that of octane (C8H18)? Amount of heat released by octane = ?.
In: Chemistry
1) A spring is 17.8 cm long when it is lying on a table. One end is then attached to a hook and the other end is pulled by a force that increases to 28.0 N , causing the spring to stretch to a length of 19.7 cm
a)What is the force constant of this spring?
b)How much work was required to stretch the spring from 17.8 cm to 19.7 cm ?
c)How long will the spring be if the 28.0 N force is replaced by a 56.0 N force?
2)Two tugboats pull a disabled supertanker. Each tug exerts a constant force of 1.95×106 N , one 15 ∘west of north and the other 15 ∘ east of north, as they pull the tanker 0.84 km toward the north.
-What is the total work they do on the supertanker?
Express your answer with the appropriate units.
3)A bullet is fired into a large stationary absorber and comes to rest. Temperature measurements of the absorber show that the bullet lost 2150 J of kinetic energy, and high-speed photos of the bullet show that it was moving at 980 m/s just as it struck the absorber.
-What is the mass of the bullet?
4)A running house cat has 13.5 J of kinetic energy at speed v.
a)At what speed (in terms of v) will she have 27.0 J of kinetic energy?
Express your answer in terms of v.
b)What would her kinetic energy be if she ran half as fast as the speed in part A?
5)About 50000 years ago, a meteor crashed into the earth near present-day Flagstaff, Arizona. Recent (2005) measurements estimate that this meteor had a mass of about 1.4×108kg (around 150000 tons) and hit the ground at 12 km/s.
a)How much kinetic energy did this meteor deliver to the ground?
Express your answer using two significant figures.
b)How does this energy compare to the energy produced in one day by a standard coal-fired power plant, which generates about 1 billion joules per second?
Express your answer using one significant figure.
6)The food calorie, equal to 4186 J, is a measure of how much energy is released when food is metabolized by the body. A certain brand of fruit-and-cereal bar contains 160 food calories per bar.
a)If a 60.0 kg hiker eats one of these bars, how high a mountain must he climb to "work off" the calories, assuming that all the food energy goes only into increasing gravitational potential energy?
b)If, as is typical, only 23.0 % of the food calories go into mechanical energy, what would be the answer to part (a)? (Note: In this and all other problems, we are assuming that 100 % of the food calories that are eaten are absorbed and used by the body. This is actually not true. A person's "metabolic efficiency" is the percentage of calories eaten that are actually used; the rest are eliminated by the body. Metabolic efficiency varies considerably from person to person.)
7)Tendons are strong elastic fibers that attach muscles to bones. To a reasonable approximation, they obey Hooke's law. In laboratory tests on a particular tendon, it was found that, when a 252 gobject was hung from it, the tendon stretched 1.20 cm .
a)Find the force constant of this tendon in N/m.
b)Because of its thickness, the maximum tension this tendon can support without rupturing is 137 N . By how much can the tendon stretch without rupturing, and how much energy is stored in it at that point?
8)Pebbles of weight w are launched from the edge of a vertical cliff of height h at speed v0. How fast (in terms of the quantities just given) will these pebbles be moving when they reach the ground if they are launched
a)straight up.
b)straight down.
c)horizontally away from the cliff.
d)at an angle θ above the horizontal.
e)How would the answers to the previous parts change if the pebbles weighed twice as much?
9)A 13.0 N package of whole wheat flour is suddenly placed on the pan of a scale such as you find in grocery stores. The pan is supported from below by a vertical spring of force constant 315 N/m .0
-If the pan has negligible weight, find the maximum distance the spring will be compressed if no energy is dissipated by friction.
10)A 15.0 g plastic ball is dropped from a height of 2.90 m and is moving at 2.70 m/s just before it hits the floor.
-How much mechanical energy was lost during the ball's fall?
In: Physics
For your final exam in electronics, you're asked to build an LC circuit that oscillates at 15kHz . In addition, the maximum current must be 0.15A and the maximum energy stored in the capacitor must be 1.0
In: Physics
Discussion Question 1: Discuss the differences between the Einstein’s Theory of Relativity and Classical Physics Theory (i.e. Galileo and Newton, etc.)
Discussion Question 2: Discuss the wave-particle duality of light and its implications. What are possible industrial applications?
In: Physics
Functions
In: Computer Science
Below is a set of data collected
at 0.95 atm
for the formation of CO
2
gas produced when calcium
carbonate is reacted with aqueous HCl:
Time (min)
Volume CO
2
(mL)
1
0.2
0
2
0.3
0
3
0.5
0
4
0.7
0
5
0.9
0
6
1
.00
7
1.2
0
8
1.3
0
9
1.5
0
10
1.7
0
11
1.9
0
12
2
.00
13
2.2
0
14
2.4
0
15
2.5
0
16
2.7
0
17
2.9
0
18
3
.00
19
3.2
0
20
3.4
0
Your assignment is as follows:
1. Create a spreadsheet in Excel (or equivalent) that
contains this data and does the following
calculations
automatically:
a. Converts each gas volume measurement to
moles of CO
2
produced
(Use a
PV = nRT to
solve
). Do this twice: one column for 0
In: Chemistry
What could a financial manager look at to determine whether his company is successful or in distress? Give an example of a success or distress in today's business world.
In: Finance
Computer Gaming Industries has just started business as a computer-based gaming company. Knowing that small computer businesses rarely remain in business longer than five years, Computer Gaming depreciates all its assets for five years. The assets include a building, integrated circuit shaper, and vehicles. Is this ethical? What impact will its action have on the net income? What, if any, is the correct action?
In: Accounting
6.Suppose you have a solution that contains 0.0420 M Ca2 and 0.0960 M Ag . If solid Na3PO4 is added to this mixture, which of the following phosphate species would precipitate out of solution first?
first part is Ca3(PO4)2
When the second cation just starts to precipitate, what percentage of the first cation remains in solution?
______ %
In: Chemistry
A borrower takes out a 30-year price level adjusted mortgage loan for $200,000 with monthly payments. The initial interest rate is 4% with 4 points. Assuming that inflation is expected to increase at the rate of 3% for the next 5 years, and a fully amortizing loan is made.
What is the inflation adjusted loan balance at the end of year 2? (Choose the nearest number)
| a. |
$ 202,372 |
|
| b. |
$ 198,597 |
|
| c. |
$ 196,478 |
|
| d. |
$ 204,555 |
What is the expected effective yield to the lender if the loan is repaid in 2 years? (Choose the nearest number)
| a. |
9% |
|
| b. |
6% |
|
| c. |
7% |
|
| d. |
12% |
In: Finance
7. A number of minor automobile accidents occur at various high-risk intersections in Teton County despite traffic lights. The Traffic Department claims that a modification in the type of light will reduce these accidents. The county commissioners have agreed to a proposed experiment. Eight intersections were chosen at random, and the lights at those intersections were modified. At the .01 significance level, is it reasonable to conclude that the modification reduced the number of traffic accidents?
| No. accidents | |
| Before | After |
| 5 | 3 |
| 7 | 7 |
| 6 | 7 |
| 4 | 0 |
| 8 | 4 |
| 9 | 6 |
| 8 | 8 |
| 10 | 2 |
In: Math
The Japanese government was pressured by the U.S. government to place limits on the number of vehicles exported to the United States by Japanese automobile producers in 1981. This is an example of
A. tariff rate quota
B, Specific tariffs
C. Voluntary export restraint
D. Ad valorem tariff
In: Economics
In: Economics
Using python!!!!
1. Copy the file web.py from class (or class notes) into your working folder.
2. Include the following imports at the top of your module (hopefully this is sufficient):
from web import LinkCollector # make sure you did 1
from html.parser import HTMLParser
from urllib.request import urlopen
from urllib.parse import urljoin
from urllib.error import URLError
3. Implement a class ImageCollector. This will be similar to the LinkCollector, given a string containing the html for a web page, it collects and is able to supply the (absolute) urls of the images on that web page. They should be collected in a set that can be retrieved with the method getImages (order of images will vary). Sample usage:
>>> ic =
ImageCollector('http://www2.warnerbros.com/spacejam/movie/jam.htm')
>>> ic.feed(
urlopen('http://www2.warnerbros.com/spacejam/movie/jam.htm').read().decode())
>>> ic.getImages()
{'http://www2.warnerbros.com/spacejam/movie/img/p-sitemap.gif', …,
'http://www2.warnerbros.com/spacejam/movie/img/p-jamcentral.gif'}
>>> ic = ImageCollector('http://www.kli.org/')
>>> ic.feed(
urlopen('http://www.kli.org/').read().decode())
>>> ic.getImages()
{'http://www.kli.org/wp-content/uploads/2014/03/KLIbutton.gif',
'http://www.kli.org/wp-content/uploads/2014/03/KLIlogo.gif'}
4. Implement a class ImageCrawler that will inherit from the Crawler developed in amd will both crawl links and collect images. This is very easy by inheriting from and extending the Crawler class. You will need to collect images in a set. Hint: what does it mean to extend? Implementation details:
a. You must inherit from Crawler. Make sure that the module web.py is in your working folder and make sure that you import Crawler from the web module.
b. __init__ - extend’s Crawler’s __init__ by adding an set attribute that will be used to store images
c. Crawl – extends Crawler’s crawl by creating an image collector, opening the url and then collecting any images from the url in the set of images being stored. I recommend that you collect the images before you call the Crawler’s crawl method.
d. getImages – returns the set of images collected
>>> c = ImageCrawler()
>>>
c.crawl('http://www2.warnerbros.com/spacejam/movie/jam.htm',1,True)
>>> c.getImages()
{'http://www2.warnerbros.com/spacejam/movie/img/p-lunartunes.gif',
…
'http://www2.warnerbros.com/spacejam/movie/cmp/pressbox/img/r-blue.gif'}
>>> c = ImageCrawler()
>>> c.crawl('http://www.pmichaud.com/toast/',1,True)
>>> c.getImages()
{'http://www.pmichaud.com/toast/toast-6a.gif',
'http://www.pmichaud.com/toast/toast-2c.gif',
'http://www.pmichaud.com/toast/toast-4c.gif',
'http://www.pmichaud.com/toast/toast-6c.gif',
'http://www.pmichaud.com/toast/ptart-1c.gif',
'http://www.pmichaud.com/toast/toast-7b.gif',
'http://www.pmichaud.com/toast/krnbo24.gif',
'http://www.pmichaud.com/toast/toast-1b.gif',
'http://www.pmichaud.com/toast/toast-3c.gif',
'http://www.pmichaud.com/toast/toast-5c.gif',
'http://www.pmichaud.com/toast/toast-8a.gif'}
5. Implement a function scrapeImages: Given a url, a filename, a depth, and Boolean (relativeOnly)., this function starts at url, crawls to depth, collects images, and then writes an html document containing the images to filename. This is not hard, use the ImageCrawler from the prior step. For example:
>>> scrapeImages('http://www2.warnerbros.com/spacejam/
movie/jam.htm','jam.html',1,True)
>>> open('jam.html').read().count('img')
62
>>>
scrapeImages('http://www.pmichaud.com/toast/',
'toast.html',1,True)
>>> open('toast.html').read().count('img')
11
link to web.py https://www.dropbox.com/s/obiyi7lnwc3rw0d/web.py?dl=0
In: Computer Science