c++
1 city.h
#pragma once
#ifndef CITY_H
#define CITY_H
#include<string>
#include<iostream>
#include<utility>
using namespace std;
class City {
public:
City(string nm, unsigned int pop) {
namePopulationPair = make_pair(nm, pop);
}
bool operator<(const City &city)const {
if (this->getName() < city.getName()) {
return true;
}
else {
return false;
}
}
void setName(string name) { namePopulationPair.first = name; }
void setPopulation(unsigned int population)
{
namePopulationPair.second = population;
}
string getName() const { return namePopulationPair.first; }
unsigned int getPopulation() const { return namePopulationPair.second; }
virtual void printInfo() const {
cout << getName() << ": " << getPopulation() << endl;
}
protected:
pair<string, unsigned int> namePopulationPair;
};
#endif
Use city.h from the previous lab without any modifications.
2 main.cpp
In main.cpp do the following step by step:
1. Globally define array cityArray[] consisting of cities with the following details:
(a) Los Angeles with population of 4 million
(b) San Diego with population of 1.5 million
(c) San Francisco with population of 900 thousand
(d) Sacramento with population of 500 thousand
(e) Stockton with the population of 300 thousand
(f) Redding with the population of 90 thousand
(g) Las Vegas with the population of 700 thousand
(h) Reno with the population of 300 thousand
(i) Portland with the population of 700 thousand
(j) Seattle with the population of 750 thousand
(k) Eugene with the population of 200 thousand
2. Globally define a vector of City objects, without initial values. Call it cityVector (1 points).
3. Pass vectors to these functions as reference, and define them as constant if the functions are not
allowed to modify them.
(a) Define function void initVector(...) that receives a vector of City objects, an array
of elements of type City as a second input, and an integer as its third input. The third input
represents the number of elements in the input array. Initialize the input queue with the elements
existing in the input array (2 points).
(b) Define function void printCityVector(...) that receives a vector of City objects
as input and prints the elements within the vector. Hint: You can use range-based for loops (2
points).
(c) Define function int mergeCityVector(...) that receives a vector of City objects as
input, along with three integers as indexes that represent the lower bound, the division point of
the vector into two halves, and the upper bound within the vector. It merges the two halves of
the vector (assuming they are sorted) according to the city populations (5 points).
(d) Define function void cityMergeSort(...) that receives a vector of City objects as
input, along with two integers as indexes that represent the lower and upper boundaries within
the vector. It does merge sort on the vector of City objects according to the city populations
(by invoking the mergeCityVector() function on sorted vectors (5 points).
In main() function do the following step by step, using the functions defined above:
(i) Initialize cityVector according to array cityArray[] using the function defined above (1
points).
(ii) Print out the entries of cityVector, using the appropriate function defined above (1 points).
(iii) Do merge sort on cityVector and print out the updated vector. (1 points).
The output of the program may look like the following:
Initializing cityVector with cityArray[]:
Los Angeles: 4000000
San Diego: 1500000
San Francisco: 900000
Sacramento: 500000
Stockton: 300000
Redding: 90000
Las Vegas: 700000
Reno: 300000
Portland: 700000
Seattle: 750000
Eugene: 200000
Merge sort on cityVector:
Redding: 90000
Eugene: 200000
Stockton: 300000
Reno: 300000
Sacramento: 500000
Las Vegas: 700000
Portland: 700000
Seattle: 750000
San Francisco: 900000
San Diego: 1500000
Los Angeles: 4000000
2
In: Computer Science
1. Complete the balance sheet for the business for 2016 and 2017.
2. In which year do you think the balance sheet is better?
|
2016 |
2017 |
|||||
|
Fixed Assets |
||||||
|
Premises |
60,000 |
74,000 |
||||
|
Equipment |
14,000 |
24,000 |
||||
|
Current Assets |
||||||
|
Stocks |
2,000 |
3,000 |
||||
|
Debtors |
5,000 |
3,000 |
||||
|
Cash at Bank |
5,000 |
2,000 |
||||
|
Current Liabilities |
||||||
|
Overdraft |
3,000 |
3,000 |
||||
|
Creditors |
3,000 |
3,000 |
||||
|
Working Capital |
||||||
|
Net Assets |
||||||
|
Financed by: |
||||||
|
Owners Capital |
40,000 |
65,000 |
||||
|
Loan |
40,000 |
35,000 |
||||
|
Capital Employed |
||||||
In: Accounting
1. What is oxidation? How do you know if a molecule/atom has undergone oxidation.
2. Describe the reactivity of alcohols (1˚, 2˚, and 3˚) to oxidation.
3. What are two ways besides IR that we can determine if we have the right product? Please explain what molecular property is measured and how borneol and camphor will show up differently in the technique.
4. When we take the IR of borneol and camphor, how will the spectra look different?
5. Why is the Camphor reaction considered “green”?
In: Chemistry
write a simple python program that takes in 6-50 random numbers the user types in and then guesses the next 6 of numbers that will be produced based on the numbers entered. it's something like a lottery program. You can use any algorithm you want but it has to be in the python programming language.
Thank you!
In: Computer Science
What are “perceptual committees”? Is there ever an incident where perceptual committees fail? If so, why?
6. What is the global superiority effect? Give an example of this phenomenon. How does this impact our day-to-day lives?
7. Compare and contrast Direct and Constructivist accounts of perception.
In: Psychology
Please explain answer a little bit I'm familiar with these all topics..just give hint with your answer... the first question is quick sort 1) (13 points) Show the results of pivoting the following array using 0.34 as the pivot value. 0.34 -4.62 8.50 -5.45 7.80 8.19 9.72 -2.85 0.88 -0.07 -0.28 -3.58
2)(13 points)
Draw the graph defined by the following adjacency matrix:
? ? ? ? -4.8 -2.3 9.7 3.9
? ? -4.6 5.1 -8.5 2.0 -2.2 -9.1
? -4.6 ? -2.9 -2.4 -3.2 2.3 ?
? 5.1 -2.9 ? ? 9.0 7.4 5.0
-4.8 -8.5 -2.4 ? ? -5.0 -6.9 -9.6
-2.3 2.0 -3.2 9.0 -5.0 ? 5.9 -7.7
9.7 -2.2 2.3 7.4 -6.9 5.9 ? -3.8
3)(13 points) Show the order in which the vertices of the graph from question 3 will be visited in a depth first traversal. Use 0, 1, 2, 3, 4, 5, 6, 7 as the names of the nodes, and assume that the neighbors of any node are given in left to right order across the matrix.
4)(13 points) Consider the following adjacency matrix. ? 4.0 3.0 1.0 4.0 ? 8.0 1.0 3.0 8.0 ? 5.0 1.0 1.0 5.0 ? Use Kruskal's algorithm to find a minimum spanning tree.
3.9 -9.1 ? 5.0 -9.6 -7.7 -3.8 ?In: Computer Science
Calculate the pH of a buffer solution after the addition of 15.00 mL of 0.100 M NaOH to 50.00mL of the buffer that originally contains 0.100 M propanoic acid and 0.0750 M Sodium propionate. The Ka for propanoic acid is 1.3x10-5.
In: Chemistry
In this assignment, you need to determine the network ID, first usable host, last usable host, range of valid addresses, and broadcast address of a network. Must be written on paper
Please write on paper
In: Computer Science
In: Other
Write one Java application based on the following directions and algorithms. Make sure the results from each of the numbered items is separate and easy to read/understand.
1.Create an array that will hold 4 string values. Write three separate statements to store your favorite color, your favorite song, and your favorite restaurant in the array elements. I do not want you to use a loop in this logic; use hard-coded index values instead. Print *ALL FOUR* of the values of the array using individual index values. What is stored in the element you did not fill?
2.Create an array that will hold 5 string values. Use a for loop to prompt the user to enter their 5 favorite movies and store each one in a separate element of the array. Print the values of the array using a For-Each loop.
3.Create an array to hold 7 doubles. Use any looping structure you want to prompt the user to enter a value and store it in the array. In a separate loop, compute the sum of the values. In a third, separate loop, display the array values in reverse order. Also display the sum.
4.Create an array that will hold 3 integers. Without prompting the user for input or using a loop, fill that array with the values 23, 0, and -5. Write decision logic to determine whether the values in each array element is negative, positive, or equal to zero. Make the decision logic loop 3 times, since we want to test 3 different values.
In: Computer Science
Use Matlab GUIDE to create a program with graphic user interfac(GUI). The program is designed to convert the temperature from Celsius to Fahrenheit and the opposite.
(Hint: use radio button)
In: Computer Science
The new market equilibrium price and the new market equilibrium quantity is as follows
Dx = 140 - 4p
Sx = 120 + p
At which of the following price for packages of herbal tea:
P=$10, $15, $8 is there a surplus, a shortage, or at equilibrium? Use a graph to help explain your answer
My thought process is that all these prices will result in a surplus because it will be greater than the MCP.
In: Economics
a) What are the different types of “light” (electromagnetic waves), starting from radio waves? Why do you think we can only see such a small portion of the electromagnetic spectrum? Why don’t we see X-rays or microwaves?
b) Explain what a photon is and what property of photons relates to different colors of light.
c) What is the frequency of light that has a wavelength of 400 nm? What is the color of such light? What is the energy of a photon of such light (in eVunits)?
In: Physics
I would like to see a java language example using classes customer() and animal() which get user input and return the information to class database().
class customer() should return user input for firstName, lastName, address, phoneNum, customerNum.
class animal() should return information for animalName, animalType, gender, animalLocation.
In: Computer Science
Hi-Tek Manufacturing, Inc., makes two types of industrial component parts—the B300 and the T500. An absorption costing income statement for the most recent period is shown: Hi-Tek Manufacturing Inc .
| Income Statement Sales | $ 1,659,600 |
| Cost of goods sold | $1,230,949 |
| Gross margin | 428,651 |
| Selling and administrative expenses | 570,000 |
| Net operating loss | $ (141,349 ) |
Hi-Tek produced and sold 60,400 units of B300 at a price of $19 per unit and 12,800 units of T500 at a price of $40 per unit. The company’s traditional cost system allocates manufacturing overhead to products using a plantwide overhead rate and direct labor dollars as the allocation base. Additional information relating to the company’s two product lines is shown below:
| B300 | T500 | Total | |
| Direct Materials | $ 400,700.00 | $ 162,500.00 | $ 563,200.00 |
| Direct Labor | $ 120,100.00 | $ 42,500.00 | $ 162,600.00 |
| Manufacturing Overhead | $ 505,149.00 | ||
| Cost of goods sold | $ 1,230,949.00 |
The company has created an activity-based costing system to evaluate the profitability of its products. Hi-Tek’s ABC implementation team concluded that $51,000 and $105,000 of the company’s advertising expenses could be directly traced to B300 and T500, respectively. The remainder of the selling and administrative expenses was organization-sustaining in nature. The ABC team also distributed the company’s manufacturing overhead to four activities as shown below:
| Activity | ||||
| Activity Cost Pool (and Activity Measure) | Manufacturing Overhead | B300 | T500 | Total |
| Machining (machine-hours) | $ 212,809 | $ 90,900.00 | $ 62,200.00 | $ 153,100.00 |
| Setups (setup hours) | $ 130,240 | 76 | 220 | 296 |
| Product-sustaining (number of products) | $ 101,200 | 1 | 1 | 2 |
| Other (organization-sustaining costs) | $ 60,900 | NA | NA | NA |
| Total manufacturing overhead cost | $ 505,149 | |||
Required:
1. Compute the product margins for the B300 and T500 under the company’s traditional costing system.
2. Compute the product margins for B300 and T500 under the activity-based costing system.
3. Prepare a quantitative comparison of the traditional and activity-based cost assignments.
In: Accounting