Assessment Question Week 2: Production Possibility
Frontier
In 2017, Nepal production of rice and machinery in 2017 was
published by the Nepal Bureau of Statistics as indicated by the
table below.
Production in Nepal
P Q R
S T U V
W X Y Z
Rice (1000 tons) 0 10
26 37 45 50
55 59 66 77
80
Machinery (units) 90 89
85 80 75 70
65 60 50 30 0
Based on the table above, a production possibility frontier for
Nepal can be plotted as below:
Use the Nepal production table and production possibility frontier
to answer the following questions.
(a) Name positions B, V and D. Explain the implications
of each of the production positions (B, V, D) on Nepal’s
economy.
(b) Supposing Nepal is operating at level T what is the
opportunity cost of producing 10,000 more tons of rice? Also,
suppose Nepal is operating at X what is the opportunity cost of
producing 70 units of machinery?
(c) Use the graph below to answer the questions that
follow
(i) Suppose Nepal begins to manufacture fertilizers,
explain the impact of the discovery of fertilizers to Nepal’s
economy using PPF.
(ii) Supposing there is a discovery of steel in Nepal,
explain the impact of steel to the economy of Nepal using a
PPF.
(iii) The Minister of Finance in Nepal advices that in
order to increase rice production and machinery, each sector
requires USD 50 billion. Explain the impact of the budgetary
allocation on the economy of Nepal using PPF.
In: Economics
Problem: Clique
In this problem IS stands for Independent Set.
The usual IS problem, that we showed in class in NP-complete is as follows:
Input: Unidrected graph G(V, E) and number k, with 1 ≤ k ≤
n.
Output: YES if G has an independent set of containing at least k
vertices.
NO if all independent sets of G contain strictly less
than k vertices.
Definition: Let G(V, E) be an undirected graph and let V ′ be a proper subset of vertives of V : V ′ ⊂ V . We sat thay V is a clique of size k=|V′| if and only if, for all u∈V′ and for all u != v in V′ the edge{u,v}∈E.
Now define the Clique problem as follows:
Input: Unidrected graph G(V, E) and number k, with 1⌉ ≤ k ≤
n.
Output: YES if G has a clique containing at least k vertices.
NO if cliques of G contain strictly less than k
vertices.
Show that IS≤ pCLIQUE.
In: Statistics and Probability
In: Operations Management
In Simple Chat, if the server shuts down while a client is connected, the client does not respond, and continues to wait for messages. Modify the client so that it responds to the shutdown of server by printing a message saying the server has shut down, and quitting. (look at the methods called connectionClosed and connectionException).
//ChatClient.java
// This file contains material supporting section 3.7 of the textbook:
// "Object Oriented Software Engineering" and is issued under the open-source
// license found at www.lloseng.com
package client;
import ocsf.client.*;
import common.*;
import java.io.*;
/**
* This class overrides some of the methods defined in the abstract
* superclass in order to give more functionality to the client.
*
* @author Dr Timothy C. Lethbridge
* @author Dr Robert Laganiè
* @author François Bélanger
* @version July 2000
*/
public class ChatClient extends AbstractClient
{
//Instance variables **********************************************
/**
* The interface type variable. It allows the implementation of
* the display method in the client.
*/
ChatIF clientUI;
//Constructors ****************************************************
/**
* Constructs an instance of the chat client.
*
* @param host The server to connect to.
* @param port The port number to connect on.
* @param clientUI The interface type variable.
*/
public ChatClient(String host, int port, ChatIF clientUI)
throws IOException
{
super(host, port); //Call the superclass constructor
this.clientUI = clientUI;
openConnection();
}
//Instance methods ************************************************
/**
* This method handles all data that comes in from the server.
*
* @param msg The message from the server.
*/
public void handleMessageFromServer(Object msg)
{
clientUI.display(msg.toString());
}
/**
* This method handles all data coming from the UI
*
* @param message The message from the UI.
*/
public void handleMessageFromClientUI(String message)
{
try
{
sendToServer(message);
}
catch(IOException e)
{
clientUI.display
("Could not send message to server. Terminating client.");
quit();
}
}
/**
* This method terminates the client.
*/
public void quit()
{
try
{
closeConnection();
}
catch(IOException e) {}
System.exit(0);
}
}
//End of ChatClient class
//EchoServer.java
// This file contains material supporting section 3.7 of the textbook:
// "Object Oriented Software Engineering" and is issued under the open-source
// license found at www.lloseng.com
import java.io.*;
import ocsf.server.*;
/**
* This class overrides some of the methods in the abstract
* superclass in order to give more functionality to the server.
*
* @author Dr Timothy C. Lethbridge
* @author Dr Robert Laganière
* @author François Bélanger
* @author Paul Holden
* @version July 2000
*/
public class EchoServer extends AbstractServer
{
//Class variables *************************************************
/**
* The default port to listen on.
*/
final public static int DEFAULT_PORT = 5555;
//Constructors ****************************************************
/**
* Constructs an instance of the echo server.
*
* @param port The port number to connect on.
*/
public EchoServer(int port)
{
super(port);
}
//Instance methods ************************************************
/**
* This method handles any messages received from the client.
*
* @param msg The message received from the client.
* @param client The connection from which the message originated.
*/
public void handleMessageFromClient
(Object msg, ConnectionToClient client)
{
System.out.println("Message received: " + msg + " from " + client);
this.sendToAllClients(msg);
}
/**
* This method overrides the one in the superclass. Called
* when the server starts listening for connections.
*/
protected void serverStarted()
{
System.out.println
("Server listening for connections on port " + getPort());
}
/**
* This method overrides the one in the superclass. Called
* when the server stops listening for connections.
*/
protected void serverStopped()
{
System.out.println
("Server has stopped listening for connections.");
}
//Class methods ***************************************************
/**
* This method is responsible for the creation of
* the server instance (there is no UI in this phase).
*
* @param args[0] The port number to listen on. Defaults to 5555
* if no argument is entered.
*/
public static void main(String[] args)
{
int port = 0; //Port to listen on
try
{
port = Integer.parseInt(args[0]); //Get port from command line
}
catch(Throwable t)
{
port = DEFAULT_PORT; //Set port to 5555
}
EchoServer sv = new EchoServer(port);
try
{
sv.listen(); //Start listening for connections
}
catch (Exception ex)
{
System.out.println("ERROR - Could not listen for clients!");
}
}
}
//End of EchoServer class
//ChatIF.java
// This file contains material supporting section 3.7 of the textbook:
// "Object Oriented Software Engineering" and is issued under the open-source
// license found at www.lloseng.com
package common;
/**
* This interface implements the abstract method used to display
* objects onto the client or server UIs.
*
* @author Dr Robert Laganière
* @author Dr Timothy C. Lethbridge
* @version July 2000
*/
public interface ChatIF
{
/**
* Method that when overriden is used to display objects onto
* a UI.
*/
public abstract void display(String message);
}
//ClientConsole.java
// This file contains material supporting section 3.7 of the textbook:
// "Object Oriented Software Engineering" and is issued under the open-source
// license found at www.lloseng.com
import java.io.*;
import client.*;
import common.*;
/**
* This class constructs the UI for a chat client. It implements the
* chat interface in order to activate the display() method.
* Warning: Some of the code here is cloned in ServerConsole
*
* @author François Bélanger
* @author Dr Timothy C. Lethbridge
* @author Dr Robert Laganière
* @version July 2000
*/
public class ClientConsole implements ChatIF
{
//Class variables *************************************************
/**
* The default port to connect on.
*/
final public static int DEFAULT_PORT = 5555;
//Instance variables **********************************************
/**
* The instance of the client that created this ConsoleChat.
*/
ChatClient client;
//Constructors ****************************************************
/**
* Constructs an instance of the ClientConsole UI.
*
* @param host The host to connect to.
* @param port The port to connect on.
*/
public ClientConsole(String host, int port)
{
try
{
client= new ChatClient(host, port, this);
}
catch(IOException exception)
{
System.out.println("Error: Can't setup connection!"
+ " Terminating client.");
System.exit(1);
}
}
//Instance methods ************************************************
/**
* This method waits for input from the console. Once it is
* received, it sends it to the client's message handler.
*/
public void accept()
{
try
{
BufferedReader fromConsole =
new BufferedReader(new InputStreamReader(System.in));
String message;
while (true)
{
message = fromConsole.readLine();
client.handleMessageFromClientUI(message);
}
}
catch (Exception ex)
{
System.out.println
("Unexpected error while reading from console!");
}
}
/**
* This method overrides the method in the ChatIF interface. It
* displays a message onto the screen.
*
* @param message The string to be displayed.
*/
public void display(String message)
{
System.out.println("> " + message);
}
//Class methods ***************************************************
/**
* This method is responsible for the creation of the Client UI.
*
* @param args[0] The host to connect to.
*/
public static void main(String[] args)
{
String host = "";
int port = 0; //The port number
try
{
host = args[0];
}
catch(ArrayIndexOutOfBoundsException e)
{
host = "localhost";
}
ClientConsole chat= new ClientConsole(host, DEFAULT_PORT);
chat.accept(); //Wait for console data
}
}
//End of ConsoleChat class
Do not know how to do for this question, could you give me some suggestions for that?
In: Computer Science
From the following balances you are required to calculate cash from operating activities.
|
Name of accounts |
December31, 2015 |
December 31, 2016 |
|
Notes receivable |
SR 7,800 |
SR 12,000 |
|
Notes payable |
SR 22,000 |
SR 16,000 |
|
Accounts receivable |
SR 49,000 |
SR 46,000 |
|
Furniture |
SR 30,000 |
SR 38,000 |
|
Accounts payable |
SR 30,000 |
SR 35,000 |
|
Advance Rent received |
SR 9,000 |
SR 5,600 |
|
Prepaid expenses |
SR 5,700 |
SR 4,200 |
|
Depreciation on Plant assets |
SR 36,000 |
SR 45,000 |
|
Net Income during the year |
----- |
SR 160,000 |
In: Accounting
In: Computer Science
Business law, please write a short court cases on cases below.
Stephen A. Wheat v. Sparks
J.T. ex rel. Thode v. Monster Mountain.
Clark’s Sales and Service v. Smith
Browning v. Poirer
Sogeti USA v. Scariano
Killian v. Ricchetti
In: Accounting
HIMT 345
Homework 05: Functions
Overview: Examine PyCharm’s “Introduction to Python”
samples for Functions. Use PyCharm to work along with exercises
from Chapter 4. Modify the grade assignment program of Hwk 04 to
utilize a function by copying the Hwk04 project and creating the
Hwk05 project.
Prior Task Completion:
1. Read Chapter 04
2. View Chapter 04’s video notes.
3. As you view the video, work along with each code sample in
PyCharm. The examples used in the video are available for you to
experiment with if you downloaded the complete Severance source
files for Chapters 3-10.
a) With PyCharm open, locate the .zip file entitled Ch 4
Functions PPT Code Samples.zip.
b) Open each of the project files for that chapter in PyCharm.
Note: The code samples are numbered in the order they are covered
in the video.
c) Start the video and follow along.
4. Complete Exercises 4.1 – 4.5 (not handed in).
Specifics: PyCharm’s “Introduction to Python” project contains
multiple examples giving the basics of conditional expressions (see
list at right). Follow the instructions to complete them. (Not
handed in.)
Use PyCharm to work along with the video solution for Exercise 4.6
from the textbook. Try to make the same mistakes (and fixes) made
by the author. (Not handed in.)
Create a copy of your Hwk04 project file, calling it
Hwk05.
1. Highlight the Hwk04 project, select
Refactor/Copy.
Important: Do not skip the process of following along with
the videos. It is a very important part of the learning
process!
2. Give it a New name: of Hwk05 and leave the To directory:
in its default state.
Leave the “Open copy in editor” box checked.
3. After clicking OK, if the project fails to open, just open it
manually as you would
any project (File | Open | Hwk05 project).
You may immediately delete Hwk04b as it is not needed in this
assignment. You may
need to Refactor | Rename both the project name and the existing
Hwk04a.py file, as
only the directory was renamed by PyCharm in creating the
copy.
Having renamed Hwk04a to Hwk05_YourLastName.py, your task is to
determine the
letter grade using a function.
Here is some pseudocode* to guide the process:
(NOTE: The assign_grade function must be declared at the top of the
Python file.)
Prompt for the test score, using try-except to verify it is
valid
Invoke (call) the function, supplying it the test score and it
returning the appropriate
letter grade;
e.g. letter_grade = assign_grade(test_score)
Display the test score and appropriate letter grade.
What to hand in:
Take screen shots of the console window verifying correct
handling of bad input as well
as letter grades for one test score in each grade range. Copy the
screen shots into a
Word document (filename Hwk05_YourLastName_Screenshots.doc) with
your name and
date in the upper right hand corner. Upload the Word doc and the
Python program file
(Hwk05_YourLastName.py) to the appropriate assignment in the
LMS.
NOTE: As was described in the previous assignment, each Python file
you create should
be documented with (minimally) the following three lines at
the top of each file:
# Filename: Hwk03.py
# Author:
# Date Created: 2016/09/05
# Purpose:
(*) pseudocode: a notation resembling a simplified programming
language, used in
program design.
HERE IS HOMEWORK4
# main function
def main():
test_score = int(input('Enter Your Test Score in the range (0-100) inclusively: '))
# for incorrect input
if test_score<0 or test_score>100:
print('Sorry, Your Input Score is not in the given Range!!! Try another time!!!')
else:
# find grade
if test_score>=90:
print("Your Grade:", 'A')
elif test_score>=80:
print("Your Grade:", 'B')
elif test_score>=70:
print("Your Grade:", 'C')
elif test_score>=60:
print("Your Grade:", 'D')
else:
print("Your Grade:", 'F')
# execution of program starts from here
if __name__ == '__main__':
main()
OUTPUT
(base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: -8 Sorry, Your Input Score is not in the given Range!!! Try another time!!! (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 105 Sorry, Your Input Score is not in the given Range!!! Try another time!!! (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 54 Your Grade: F (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 64 Your Grade: D (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 75 Your Grade: C (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 85 Your Grade: B (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 95 Your Grade: A (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 100 Your Grade: A (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg100.py Enter Your Test Score in the range (0-100) inclusively: 0 Your Grade: F (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$
# main() function
def main():
# prompt first name
first_name = input('First name : ')
try:
# prompt current age
cur_age = int(input("Current Age (in years) : "))
except:
print("Sorry you didn't inputted correct current age value!!! Try another time")
return
try:
# prompt expected life span
life_span = int(input("Expected life span (in years) : "))
except:
print("Sorry you didn't inputted correct expected life span value!!! Try another time")
return
# calculate age in days
age_days = cur_age * 365
# calculate days left to live
days_left = (life_span * 365) - age_days
# print final message
print(first_name + " you are " + str(age_days) + " days old. You have " + str(days_left) + " days left to live.")
# execution of program starts from here
if __name__ == '__main__':
main()
OUTPUT
(base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg101.py First name : Chegg Expert Current Age (in years) : Fifty-Five Sorry you didn't inputted correct current age value!!! Try another time (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg101.py First name : Chegg Expert Current Age (in years) : 26 Expected life span (in years) : Fifty-Five Sorry you didn't inputted correct expected life span value!!! Try another time (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$ python chegg101.py First name : Chegg Expert Current Age (in years) : 26 Expected life span (in years) : 75 Chegg Expert you are 9490 days old. You have 17885 days left to live. (base) avianjjai@avianjjai-Vostro-3578:~/Desktop/Chegg$
In: Computer Science
20 mL of 15% HCl(v/v)
1000 mL of 10% HCl(w/v)
Give the percentages of the following: 130 mg of HCl + 90 g of H20
How many grams of sodium chloride are there in 0.75 L of a 5% solution?
What weight of NaOH would be required to prepare 500 mL of a 1.5 M solution?
A solution contains 25 g NaCl/L. What is its molarity?
What is the molecular weight of NaCl?
What is the equivalent weight of NaCl?
What is the molecular weight of MgCl2?
What is the equivalent weight of MgCl2?
Describe how to make a 3M solution of Na2SO4
What weight of H2SO4 is required to prepare 500 mL of a 2M solution?
Explain how to prepare a 2N solution of HCl
Explain how to prepare a 3N solution of MgCl2
Please explain how to prepare the following:
400 ml of a 2% glucose solution from a 50% solution available.
A 2% solution of HCL is required for a procedure. A 6% solution is available. How much of the 6% solution will be required to make 1000 mL of a 2% solution?
A procedure calls for acetic acid and water; with the proportions being one part acetic acid to four parts water. 200 mL are needed. How much acetic acid and water are required?
1 L of 70% alcohol is needed. How much 95% alcohol is required to make the 70% solution?
75 mL of a 1N HCL solution is needed. You have a 5N solution available. How will you go about preparing this solution?
In: Chemistry
The Fitzhugh-Nagumo model for the electrical impulse in a neuron states that, in the absence of relaxation effects, the electrical potential in a neuron v(t) obeys the differential equation
dv/dt = −v[v2 − (1 + a)v + a]
where a is a positive constant such that 0 < a < 1.
(a) For what values of v is v unchanging (that
is, dv/dt = 0)? (Enter your answers as a comma-separated
list.)
v = ______
(b) For what values of v is v increasing? (Enter your answer using interval notation.)
______
(c) For what values of v is v decreasing? (Enter
your answer using interval notation.)
______
Please show all work neatly, line by line, and justify steps so I can learn.
Thank you!
In: Math