The density of liquid methanol, CH3OH (FM=34.05), is 0.791g/mL at 77 degrees F. What is this same temperature in K, and how many methanol molecules will occupy a cubic container, 1mm on each side?
In: Chemistry
1 What are 5 major Strengths of the Patient Protection and Affordable Care Act?
2 What are 5 major Weaknesses of the Patient Protection and Affordable Care Act?
3. What are 5 major Opportunities of the Patient Protection and Affordable Care Act?
4. What are 5 major Threats of the Patient Protection and Affordable Care Act?
In: Nursing
In a routine atomic absorption spectrometry determination of metal ions in blood), an analyst needs to obtain the blood-level concentration of lithium in patients taking lithium carbonate, Li2CO3, as a treatment for mental disorders. What specific type of light source is required for the AAS analysis of the lithium content of the blood samples?
In: Other
The following information pertains to the York Company for the
year ending December
31, 2019.
$ Hours
Revenue 240,000
Interest Revenue 50,000
Raw materials used 40,000
Indirect Labour 4,000
Indirect Materials 9,000
Utilities [factory] 4,500
Depreciation of factory equipment 10,000
Depreciation of factory buildings 19,000
Depreciation of admin buildings 5,000
Marketing costs 30,000
Wages [Store] 10,000
Utilities [store] 6,000
Supplies [store] 3,500
Direct Labour Hours 2000
Hourly Rate for direct labour 10
Finished Goods Inventory Jan 1 2019 7,000
Finished Goods Inventory Dec 31 2019 15,000
Bond Payable 65,000
Interest Rate 10%
Tax rate 22%
REQUIRED
1. Prepare a budgeted COGS statement
2. Prepare a projected income statement
In: Accounting
A healthy, fully functioning brain is key in the learning process. Please discuss how the hindbrain, midbrain, and forebrain work together to help promote learning. Please also discuss at least 1 brain injury or disease and the potential issues that could arise as a result.
The longer the answer the better. This is an essay question. No copy pasted answers, please.
In: Psychology
IDENTIFY THREE MAIN LEGAL SYSTEMS OF IMPORTANCE TO INTERNATIONAL BUSINESS. COMPARE AND CONTRAST THE THREE MAIN LEGAL SYSTEMS IN DETAIL.
In: Operations Management
0. Introduction.
In this lab assignment, you will extend some simple Java classes that represent plane figures from elementary geometry. The object of this assignment is not to do anything useful, but rather to demonstrate how methods can be inherited by extending classes.
1. Theory.
A polygon is a closed plane figure with three or more
sides, all of which are line segments. The perimeter of a
polygon is the sum of the lengths of its sides. A
rectangle is a polygon with exactly four sides that meet
at 90° angles. Like a polygon, it has a perimeter. It also has an
area, the product of its base and height. A
square is a rectangle whose sides are all the same length.
Like a rectangle, it has a perimeter and an area.
Polygons, rectangles, and squares
make up an is-a hierarchy. The hierarchy gets its name
because a square is-a rectangle, and a rectangle
is-a polygon. Is-a hierarchies can be easily modeled by
Java classes using the extends keyword.
2. Implementation.
The following is the source code for a Java class whose instances represent polygons. The file Polygon.java on Canvas contains a copy of this source code. You will need it to complete the laboratory assignment.
class Polygon
{
private int[] sideLengths;
public Polygon(int sides, int ... lengths)
{
int index = 0;
sideLengths = new int[sides];
for (int length: lengths)
{
sideLengths[index] =
length;
index += 1;
}
}
public int side(int number)
{
return sideLengths[number];
}
public int perimeter()
{
int total = 0;
for (int index = 0; index <
sideLengths.length; index += 1)
{
total += side(index);
}
return total;
}
}
The class Polygon uses a private array called sideLengths to
store the lengths of a polygon’s sides. The array’s length,
sideLengths.length, is the number of sides that the polygon has.
The class Polygon also has a has a public constructor and two
public methods. To keep things simple, they do not check their
arguments for correctness, as they would if Polygon was part of a
real program.
The constructor takes four or more
arguments and returns an instance of Polygon that represents a
polygon. The first argument is the number of sides that the polygon
has. The remaining arguments are the lengths of those sides. For
example, the Java statement:
Polygon triangle = new Polygon(3, 3, 4, 5);
declares the variable triangle and sets it to an instance of
Polygon that represents a triangle (because the first argument says
it has 3 sides). The lengths of the triangle’s sides are 3, 4, and
5.
The three dots ‘...’ in the
constructor mean that it can take zero or more extra integer
arguments after its first argument. The for-loop with the colon
visits the extra arguments one at a time. Don’t worry if those
parts of Java are unfamiliar. You don’t have to know how the
constructor works, only how to call it.
The method side returns the length
of a polygon’s side. Sides are numbered starting from 0. For
example, the expression triangle.side(0) returns 3, the expression
triangle.side(1) returns 4, and the expression triangle.side(2)
returns 5.
The method perimeter returns a
polygon’s perimeter, the sum of the lengths of its sides. For
example, the expression triangle.perimeter() returns 3 + 4 + 5 =
12.
For this assignment, you must write
a class called Rectangle. As its name suggests, each instance of
Rectangle must represent a rectangle. Along with a constructor,
Rectangle must provide two methods, called area and perimeter. The
method area must return the integer area of the rectangle, and the
method perimeter must return the integer perimeter of the
rectangle.
You must also write another class,
called Square. As its name suggests, each instance of Square must
represent a square. Along with a constructor, Square must provide
two methods, called area and perimeter. The method area must return
the integer area of the square, and the method perimeter must
return the integer perimeter of the square.
The following driver program shows
examples of how the constructors and methods of Rectangle and
Square must work.
class Shapes
{
public static void main(String[] args)
{
Rectangle wreck = new Rectangle(3,
5); // Make a 3 × 5 rectangle.
System.out.println(wreck.area()); // Print
its area, 15.
System.out.println(wreck.perimeter()); // Print
its perimeter, 16.
Square nerd = new
Square(7); // Make
a 7 × 7 square.
System.out.println(nerd.area()); // Print
its area, 49.
System.out.println(nerd.perimeter() // Print
its perimeter, 28.
}
}
Your classes Rectangle and Square must use the extends keyword,
so they will inherit methods from other classes. Also, each class
must inherit as many of its methods as possible from those other
classes. YOU WILL LOSE POINTS FOR DEFINING A METHOD INSIDE
A CLASS, IF IT COULD HAVE BEEN INHERITED FROM ANOTHER
CLASS!
Here’s a hint about how to write the
constructors for Rectangle and Square. Suppose that a class
Triangle extends the class Polygon. Then Polygon is the
superclass of Triangle. The keyword super can be used to
call the constructor that belongs to a superclass. For example,
Triangle’s constructor, which takes the lengths of a triangle’s
three sides, might look like this.
public Triangle(int a, int b, int c)
{
super(3, a, b, c);
}
It uses Polygon’s constructor to make a polygon with 3 sides, whose lengths are a, b, and c. If super is used in this way, then it must be the first statement in the constructor. You don’t have to write Triangle—this was only an example!
3. Deliverables.
The file tests6.java contains a driver class whose a main method
performs 12 public tests, worth 1 point each. Each public
test is a call to println, along with a comment that shows what it
must print. To grade your work, the TA’s will run the public tests
using your Rectangle and Square classes. If a public test behaves
exactly as it should, then you will receive 1 point for it.
In addition, the TA’s will do 5
private tests on your Rectangle and Square classes. You
will not be told what the private tests are, but they are worth 2
points each, and they determine if Rectangle and Square have
inherited as many methods as possible. The TA’s will do the same
private tests for all students, and these tests will be made public
only after all the work for this lab has been graded.
Your score for this lab is the sum
of the points you get for the public tests, and the points you get
for the private tests, for a maximum of 22 points. Here is what you
must turn in.
Source code for the class Rectangle. Its instances must provide the methods side, area and perimeter. These methods are not necessarily defined in Rectangle: some or all may be inherited.
Source code for the class Square. Its instances must provide the methods side, area and perimeter. These methods are not necessarily defined in Square: some or all may be inherited.
In: Computer Science
In an air standard diesel cycle, the conditions of the air at the start of the compression stroke are 2 bar and 30℃. The pressure rises to 30bar after compression, and through combustion, 1200 kJ of energy is added per kg air. Calculate
In: Mechanical Engineering
IDENTIFY AND EXPLAIN FULLY ANY 3 COMPONENTS OF CULTURE AND THEIR IMPORTANCE TO INTERNATIONAL BUSINESS PROFESSIONALS.
In: Operations Management
In: Operations Management
what does the unwritten constitution of Great Britain work?
In: Psychology
1. EXPLAIN THE STEPS TO THE GLOBAL STRATEGIC PLANNING PROCESS WITH EXAMPLES.
In: Operations Management
Sketch a PV diagram and find the work done by the gas during the following stages. (Draw the PV diagram on paper. Your instructor may ask you to turn in this work.)
(a) A gas is expanded from a volume of 1.0 L to 2.6 L at a
constant pressure of 3.1 atm.
J
(b) The gas is then cooled at constant volume until the pressure
falls to 1.8 atm.
J
(c) The gas is then compressed at a constant pressure of 1.8 atm
from a volume of 2.6 L to 1.0 L. [Note: Be careful of the
signs.]
J
(d) The gas is heated until its pressure increases from 1.8 atm to
3.1 atm at a constant volume.
J
(e) Find the net work done during the complete cycle.
J
In: Physics
Prompt the user to enter a string of their choosing. Store the
text in a string. Output the string. (1 pt)
Ex:
Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue! You entered: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue!
(2) Implement a print_menu() function, which has a string as a
parameter, outputs a menu of user options for analyzing/editing the
string, and returns the user's entered menu option and the sample
text string (which can be edited inside the print_menu() function).
Each option is represented by a single character.
If an invalid character is entered, continue to prompt for a
valid choice. Hint: Implement the Quit menu option before
implementing other options. Call print_menu() in the main
section of your code. Continue to call print_menu() until the user
enters q to Quit. (3 pts)
Ex:
MENU c - Number of non-whitespace characters w - Number of words f - Fix capitalization r - Replace punctuation s - Shorten spaces q - Quit Choose an option:
(3) Implement the get_num_of_non_WS_characters() function.
get_num_of_non_WS_characters() has a string parameter and returns
the number of characters in the string, excluding all whitespace.
Call get_num_of_non_WS_characters() in the print_menu() function.
(4 pts)
Ex:
Number of non-whitespace characters: 181
(4) Implement the get_num_of_words() function. get_num_of_words()
has a string parameter and returns the number of words in the
string. Hint: Words end when a space is reached except for the
last word in a sentence. Call get_num_of_words() in the
print_menu() function. (3 pts)
Ex:
Number of words: 35
(5) Implement the fix_capitalization() function.
fix_capitalization() has a string parameter and returns an updated
string, where lowercase letters at the beginning of sentences are
replaced with uppercase letters. fix_capitalization() also returns
the number of letters that have been capitalized. Call
fix_capitalization() in the print_menu() function, and then output
the the edited string followed by the number of letters
capitalized. Hint 1: Look up and use Python functions
.islower() and .upper() to complete this task. Hint 2: Create an
empty string and use string concatenation to make edits to the
string. (3 pts)
Ex:
Number of letters capitalized: 3 Edited text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue!
(6) Implement the replace_punctuation() function.
replace_punctuation() has a string parameter and two keyword
argument parameters exclamation_count and
semicolon_count. replace_punctuation() updates the
string by replacing each exclamation point (!) character with a
period (.) and each semicolon (;) character with a comma (,).
replace_punctuation() also counts the number of times each
character is replaced and outputs those counts. Lastly,
replace_punctuation() returns the updated string. Call
replace_punctuation() in the print_menu() function, and then output
the edited string. (3 pts)
Ex:
Punctuation replaced exclamation_count: 1 semicolon_count: 2 Edited text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here, our hopes and our journeys continue.
(7) Implement the shorten_space() function. shorten_space() has a
string parameter and updates the string by replacing all sequences
of 2 or more spaces with a single space. shorten_space() returns
the string. Call shorten_space() in the print_menu() function, and
then output the edited string. Hint: Look up and use Python
function .isspace(). (3 pt)
Ex:
Edited text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue!
In: Computer Science
Identifying appropriate data mining technique(s) for reaching goals on : innovation of intelligence transportation system nowadays .
In: Computer Science