Discuss age-related changes that occur in the remainder of the axial skeleton
In: Anatomy and Physiology
An ODE for Newton’s law of cooling, ??/?? + ?? = ??(?) relates indoor temperature changes u(t) to outdoor temperature changes modeled by the function ?(?) = ? + ? cos(??) + ? sin(??). k is a constant that measures how well a building is insulated and t is time in hours. Suppose your air-conditioner is broken. You want to find out how outdoor temperature effects the temperature in your house by doing the following:
(a) Find a model for outdoor temperature, A(t). Specifically find a, b and c. Use ω = π/12 for a 24-hour time period. Use estimates of the high and low temperature of your current location. Assume the high temperature occurs at 4 pm.
(b) Solve the ODE above for u(t). Use k = 0.3 (a typically insulated building) and your equation from part (a). Use u(0) = temperature at midnight in your location for the initial condition.
(c) Create a graph with both your solution function and the outdoor temperature function.
(d) When does the maximum indoor temperature occur?
In: Other
Does the gravitational force of a satellite changes depending on the orbit it follows
In: Physics
16. Why is it important to be able to adapt to changes in technology and work organisation in a timely manner?
In: Accounting
In this assignment we are not allowed to make changes to Graph.h it cannot be changed! I need help with the Graph.cpp and the Driver.cpp.
Your assignment is to implement a sparse adjacency matrix data structure Graph that is defined in the header file Graph.h. The Graph class provides two iterators. One iterator produces the neighbors for a given vertex. The second iterator produces each edge of the graph once.
Additionally, you must implement a test program that fully exercises your implementation of the Graph member functions. Place this program in the main() function in a file named Driver.cpp.
The purpose of an iterator is to provide programmers a uniform way to iterate through all items of a data structure using a forloop. For example, using the Graph class, we can iterate thru the neighbors of vertex 4 using:
Graph::NbIterator nit ; for (nit = G.nbBegin(4); nit != G.nbEnd(4) ; nit++) { cout << *nit << " " ; } cout << endl ;
The idea is that nit (for neighbor iterator) starts at the beginning of the data for vertex 4 in nz and is advanced to the next neighbor by the ++ operator. The for loop continues as long as we have not reached the end of the data for vertex 4. We check this by comparing against a special iterator for the end, nbEnd(4). This requires the NbIterator class to implement the ++, !=and * (dereference) operators.
Similarly, the Graph class allows us to iterate through all edges of a graph using a for loop like:
Graph::EgIterator eit ; tuple<int,int,int> edge ; for (eit = G.egBegin() ; eit != G.egEnd() ; eit++) { edge = *eit ; // get current edge cout << "(" << get<0>(edge) << ", " << get<1>(edge) << ", " << get<2>(edge) << ") " ; } cout << endl ;
Note that each edge should be printed only once, even though it is represented twice in the sparse adjacency matrix data structure.
Since a program may use many data structures and each data structure might provide one or more iterators, it is common to make the iterator class for a data structure an inner class. Thus, in the code fragments above, nit and eit are declared asGraph::NbIterator and Graph::EgIterator objects, not just NbIterator and EgIterator objects.
Here are the specifics of the assignment, including a description for what each member function must accomplish.
Requirement: your implementation must dynamically resize the m_nz and m_ci arrays. See the descriptions of Graph(constructor) and addEdge, below.
Requirement: other than the templated tuple class, you must not use any classes from the Standard Template Library or other sources, including vector and list. All of the data structure must be implemented by your own code.
Requirement: your code must compile with the original Graph.h header file. You are not allowed to make any changes to this file. Yes, this prevents you from having useful helper functions. This is a deliberate limitation of this project. You may have to duplicate some code.
Requirement: a program fragment with a for loop that uses your NbIterator must have worst case running time that is proportional to the number of neighbors of the given vertex.
Requirement: a program fragment with a for loop that uses your EgIterator must have worst case running time that is proportional to the number of vertices in the graph plus the number of edges in the graph.
Graph.h:
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include <stdexcept> // for throwing out_of_range exceptions
#include <tuple> // for tuple template
class Graph {
public:
// Graph constructor; must give number of vertices
Graph(int n);
// Graph copy constructor
Graph(const Graph& G);
// Graph destructor
~Graph();
// Graph assignment operator
const Graph& operator= (const Graph& rhs);
// return number of vertices
int numVert();
// return number of edges
int numEdge();
// add edge between u and v with weight x
void addEdge(int u, int v, int x);
// print out data structure for debugging
void dump();
// Edge Iterator inner class
class EgIterator {
public:
// Edge Iterator constructor; indx can be used to
// set m_indx for begin and end iterators.
EgIterator(Graph *Gptr = nullptr, int indx = 0);
// Compare iterators; only makes sense to compare with
// end iterator
bool operator!= (const EgIterator& rhs);
// Move iterator to next printable edge
void operator++(int dummy); // post increment
// return edge at iterator location
std::tuple<int,int,int> operator*();
private:
Graph *m_Gptr; // pointer to associated Graph
int m_indx; // index of current edge in m_nz
int m_row; // corresponding row of m_nz[m_indx]
};
// Make an initial edge Iterator
EgIterator egBegin();
// Make an end iterator for edge iterator
EgIterator egEnd();
// Neighbor Iterator inner class
class NbIterator {
public:
// Constructor for iterator for vertices adjacent to vertex v;
// indx can be used to set m_indx for begin and end iterators
NbIterator(Graph *Gptr = nullptr, int v = 0, int indx = 0);
// Compare iterators; only makes sense to compare with
// end iterator
bool operator!=(const NbIterator& rhs);
// Move iterator to next neighbor
void operator++(int dummy);
// Return neighbor at current iterator position
int operator*();
private:
Graph *m_Gptr; // pointer to the associated Graph
int m_row; // row (source) for which to find neighbors
int m_indx; // current index into m_nz of Graph
};
// Make an initial neighbor iterator
NbIterator nbBegin(int v);
// Make an end neighbor iterator
NbIterator nbEnd(int v);
private:
int *m_nz; // non-zero elements array
int *m_re; // row extent array
int *m_ci; // column index array
int m_cap; // capacity of m_nz and m_ci
int m_numVert; // number of vertices
int m_numEdge; // number of edges
};
#endif
Graph.cpp outline:
#include "Graph.h"
Graph::Graph(int n) {
}
Graph::Graph(const Graph& G) {
}
Graph::~Graph() {
}
const Graph& Graph::operator= (const Graph& rhs) {
}
// This Function will return the number of vertices in the
graph
int Graph::numVert() {
}
int Graph::numEdge() {
}
void Graph::addEdge(int u, int v, int x) {
}
void Graph::dump() {
}
Graph::EgIterator::EgIterator(Graph *Gptr = nullptr, int index =
0) {
}
bool Graph::EgIterator::operator!= (const EgIterator& rhs)
{
}
void Graph::EgIterator::operator ++(int dummy) {
}
std::tuple<int, int, int> Graph::EgIterator::operator *()
{
}
Graph::EgIterator Graph::egBegin() {
}
Graph::EgIterator Graph::egEnd() {
}
Graph::NbIterator::NbIterator(Graph *Gptr = nullptr, int v = 0,
int indx = 0) {
}
bool Graph::NbIterator::operator !=(const NbIterator& rhs)
{
}
void Graph::NbIterator::operator ++(int dummy) {
}
int Graph::NbIterator::operator *() {
}
Graph::NbIterator Graph::nbBegin(int v) {
}
Graph::NbIterator Graph::nbEnd(int v) {
}
In: Computer Science
Changes in the economy have determined that for the EZ shipping company, a surcharge will be assessed on all packages that meet certain criteria. The surcharge is a function of the characteristics of the package and the zip code to which it is sent.
1. The regular charges for shipping are calculated as
follows:
For all weights five pounds and under, the
shipping cost is $12.00.
For weights over five pounds, the charge
is calculated as follows:
If length * width * height + weight is:
greater than 5 and less than or equal to 15, the shipping cost is 14.00
greater than 15 and less than or equal to 34, the shipping cost is 17.00
greater than 34 and less than or equal to 45, the shipping cost is 21.00
greater than 45 and less than or equal to 60, the shipping cost is 33.00
greater than 60, the shipping cost is 105.00
2. The additional charges are calculated as follows:
If the first digit of the zip code is a "4" then there is an additional surcharge of 5% on the shipping cost.
If the first digit of the zip code is a "6" then there is an additional surcharge of 9% on the shipping cost.
For all other zip codes there is an additional surcharge of 14% on the shipping cost.
3. Finally, if the zip code is even, then there is an additional surcharge of 2% of the shipping
cost.
Write a program that allows the user to input (in this order) the zip code, weight, length, width and height of the package then prints out the following:
The zip code and dimensions of the package
The shipping cost
The surcharge
The total shipping cost (shipping cost plus surcharge(s))
I have written out the code and have been able to get it to run but when I added in the 2% for even numbers portion of my code every thing went weird with my outputs. Every thing still compiles and works but I am not recieving the outputs I desire. Any help remedying this would be greatly appreciated.
import java.util.Scanner;
//allows use of scanner for keyboard inputs
public class Shipping
// Class titling
{
public static void main(String[] args)
{
{
int zip;
double weight;
double length;
double width;
double height;
double surcharge;
double surcharge2;
double shippingCost;
//Variables that will need defining for the shipping
process
Scanner keyboard = new Scanner(System.in);
System.out.println("Hello, Welcome to EZ Shipping services! \n
Please input the important details of your shipment when
prompted");
System.out.println("What is the weight of your package? ");
weight = keyboard.nextDouble();
System.out.println("What is the length of your package? ");
length = keyboard.nextDouble();
System.out.println("What is the width of your package? ");
width = keyboard.nextDouble();
System.out.println("What is the height of youre package? ");
height = keyboard.nextDouble();
//Print outs for package detail inputs
double packages=length*width*height+weight;
//Package variables combined and stored
{
shippingCost = 12;
//Stock sipping cost 12$
}
if (weight >5)
{
if (packages >=5.1 || packages <= 15)
{
shippingCost= 14;
// if the package weight is above 5 but less than 15 the cost is
increased to 14$
}
else if (packages >= 15.1 || packages <= 34 )
{
shippingCost= 17;
// if the package weight is above 15 but less than 34 the cost is
increased to 17$
}
else if (packages >= 34.1 || packages <= 45)
{
shippingCost= 21;
// if the package weight is above 34 but less than 45 the cost is
increased to 21$
}
else if (packages >= 45.1|| packages <= 60)
{
shippingCost= 33;
// if the package weight is above 45 but less than 60 the cost is
increased to 33$
}
else if (packages > 60)
{
shippingCost= 105;
// if the package weight is above 60 cost is increased to a flat
105$
}
}
System.out.println("What is your zip code? ");
zip = keyboard.nextInt();
if(zip == 4)
{
surcharge = shippingCost*0.05;
// if the zip code starts with a 4 a 5% surcharge is added
}
else if(zip == 6)
{
surcharge = shippingCost*0.09;
// if the zip code starts with a 6 a 9% surcharge is added
}
else
{
surcharge = shippingCost*0.14;
// all other zip codes have a 14% surcharge added
}
{
if (zip % 2 == 0 );
surcharge2 = shippingCost*.02;
// calculation for if package is even zip code or not, if even add
surcharge of 2%
}
double cost = shippingCost + surcharge + surcharge2;
// calculation for cost
double total;
total = shippingCost + surcharge + surcharge2 + packages;
// calculation for total
System.out.print("The Shipping Cost $"+ cost);
System.out.print(" Total with charges $"+ total);
// Final read out
}
}
}
In: Computer Science
When a cast operator is applied to a variable, it changes the contents of a variable.
True
False
In: Computer Science
EXPECTED CHANGES IN MARKETING STRATEGIES AFTER CORONA VIRUS DISEASE ?
In: Operations Management
Give an example of a 2x2 matrix of numbers that represent the changes in the size of a predator-prey relationship. Then, conduct an eignvalue/eigenvector analysis of the matrix. Determine the long-term scaling factor for your populations and the long-term distribution of the predators to prey.
Then, compute trajectories for several different starting values of predators and prey. Use eigenvectors to simplify the computation of these trajectories.
In: Advanced Math
In this assignment we are not allowed to make changes to Graph.h it cannot be changed! I need help with the Graph.cpp and the Driver.cpp.
Your assignment is to implement a sparse adjacency matrix data structure Graph that is defined in the header file Graph.h. The Graph class provides two iterators. One iterator produces the neighbors for a given vertex. The second iterator produces each edge of the graph once.
Additionally, you must implement a test program that fully exercises your implementation of the Graph member functions. Place this program in the main() function in a file named Driver.cpp.
The purpose of an iterator is to provide programmers a uniform way to iterate through all items of a data structure using a forloop. For example, using the Graph class, we can iterate thru the neighbors of vertex 4 using:
Graph::NbIterator nit ; for (nit = G.nbBegin(4); nit != G.nbEnd(4) ; nit++) { cout << *nit << " " ; } cout << endl ;
The idea is that nit (for neighbor iterator) starts at the beginning of the data for vertex 4 in nz and is advanced to the next neighbor by the ++ operator. The for loop continues as long as we have not reached the end of the data for vertex 4. We check this by comparing against a special iterator for the end, nbEnd(4). This requires the NbIterator class to implement the ++, !=and * (dereference) operators.
Similarly, the Graph class allows us to iterate through all edges of a graph using a for loop like:
Graph::EgIterator eit ; tuple<int,int,int> edge ; for (eit = G.egBegin() ; eit != G.egEnd() ; eit++) { edge = *eit ; // get current edge cout << "(" << get<0>(edge) << ", " << get<1>(edge) << ", " << get<2>(edge) << ") " ; } cout << endl ;
Note that each edge should be printed only once, even though it is represented twice in the sparse adjacency matrix data structure.
Since a program may use many data structures and each data structure might provide one or more iterators, it is common to make the iterator class for a data structure an inner class. Thus, in the code fragments above, nit and eit are declared asGraph::NbIterator and Graph::EgIterator objects, not just NbIterator and EgIterator objects.
Here are the specifics of the assignment, including a description for what each member function must accomplish.
Requirement: your implementation must dynamically resize the m_nz and m_ci arrays. See the descriptions of Graph(constructor) and addEdge, below.
Requirement: other than the templated tuple class, you must not use any classes from the Standard Template Library or other sources, including vector and list. All of the data structure must be implemented by your own code.
Requirement: your code must compile with the original Graph.h header file. You are not allowed to make any changes to this file. Yes, this prevents you from having useful helper functions. This is a deliberate limitation of this project. You may have to duplicate some code.
Requirement: a program fragment with a for loop that uses your NbIterator must have worst case running time that is proportional to the number of neighbors of the given vertex.
Requirement: a program fragment with a for loop that uses your EgIterator must have worst case running time that is proportional to the number of vertices in the graph plus the number of edges in the graph.
Graph.h:
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include <stdexcept> // for throwing out_of_range exceptions
#include <tuple> // for tuple template
class Graph {
public:
// Graph constructor; must give number of vertices
Graph(int n);
// Graph copy constructor
Graph(const Graph& G);
// Graph destructor
~Graph();
// Graph assignment operator
const Graph& operator= (const Graph& rhs);
// return number of vertices
int numVert();
// return number of edges
int numEdge();
// add edge between u and v with weight x
void addEdge(int u, int v, int x);
// print out data structure for debugging
void dump();
// Edge Iterator inner class
class EgIterator {
public:
// Edge Iterator constructor; indx can be used to
// set m_indx for begin and end iterators.
EgIterator(Graph *Gptr = nullptr, int indx = 0);
// Compare iterators; only makes sense to compare with
// end iterator
bool operator!= (const EgIterator& rhs);
// Move iterator to next printable edge
void operator++(int dummy); // post increment
// return edge at iterator location
std::tuple<int,int,int> operator*();
private:
Graph *m_Gptr; // pointer to associated Graph
int m_indx; // index of current edge in m_nz
int m_row; // corresponding row of m_nz[m_indx]
};
// Make an initial edge Iterator
EgIterator egBegin();
// Make an end iterator for edge iterator
EgIterator egEnd();
// Neighbor Iterator inner class
class NbIterator {
public:
// Constructor for iterator for vertices adjacent to vertex v;
// indx can be used to set m_indx for begin and end iterators
NbIterator(Graph *Gptr = nullptr, int v = 0, int indx = 0);
// Compare iterators; only makes sense to compare with
// end iterator
bool operator!=(const NbIterator& rhs);
// Move iterator to next neighbor
void operator++(int dummy);
// Return neighbor at current iterator position
int operator*();
private:
Graph *m_Gptr; // pointer to the associated Graph
int m_row; // row (source) for which to find neighbors
int m_indx; // current index into m_nz of Graph
};
// Make an initial neighbor iterator
NbIterator nbBegin(int v);
// Make an end neighbor iterator
NbIterator nbEnd(int v);
private:
int *m_nz; // non-zero elements array
int *m_re; // row extent array
int *m_ci; // column index array
int m_cap; // capacity of m_nz and m_ci
int m_numVert; // number of vertices
int m_numEdge; // number of edges
};
#endifIn: Computer Science