Lab 2 – Classes

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"
   

include the header files for the three classes

Overview

The purpose of this assignment is to give you some experience writing classes in C++, including utilizing accessors and constructors to organize data properly.

Description

This program will represent a hypothetical car production line, which consists of a chassis (body of a vehicle) and wheels. These two components will be used to make fully functioning vehicles (just use your imagination). To that end, there are three classes you will be writing:

• Vehicle

• Chassis

• Wheel

For this assignment, main.cpp will be provided for you, so you don’t have to worry about the structure of the program. Instead, you can focus solely on the structure of the classes and their interactions. I suggest looking at main closely, to help you understand the structure of the project. Chassis The Chassis class is the backbone of your vehicle. You will need to store the following data:

• The size of the chassis (small, medium, large)

• The quality of the chassis (poor, fair, good)

• The number of wheels it can support The number of wheels a given chassis can support is dependent on the size of the vehicle. If the vehicle is small, it functions with 3 wheels (the tri-wheeled wonder).

If it is medium, 4 wheels are required. If the vehicle is large, you will need to have 6 wheels. The default constructor for the chassis will insure it is a medium sized chassis of fair quality. You will also need to implement two more constructors, one that will allow you to specify a size for the chassis, and one that will allow you to specify a size and quality for the chassis. Finally, you will need a getter method for the number of wheels called getNumWheels(). Wheels Your Wheel class should contain variables for the following:

• Mileage Left

• Condition the wheel is in (poor, fair, good) The default condition for Wheels made will be fair. A fair wheel will have 10,000 miles available to it at the start. A good wheel will have 20,000 and a poor wheel will start with 5,000. You will once again need a default constructor and a second constructor that overrides the condition of the wheel. Vehicle The Vehicle class will be the finished product of your production line, being comprised of the other objects defined below. You will need to store the following data: • The price • Wheels • A Chassis (body of car)

• Is it drivable? (Boolean) The quality of the chassis and the condition of the wheels will determine the price of the vehicle. The base price of all vehicles is 500. The chassis will apply a multiplier of 5, 8 or 12 to this, depending on its quality. Likewise, the quality of each wheel will apply a multiplier of 1.5, 1.8 or 2.2. (Maybe price should be a float to account for this?). Additionally, a vehicle only becomes drivable once it has the appropriate number of wheels added to it. An example: A good, small chassis with 2 poor wheels and 1 fair wheel. Bolded is the wheel multipliers (3 of them). 500 * 12 * (1.5 * 1.5 * 2.2) = 29,700 In addition to the above, you will need to implement the following methods:

• addWheel() will is fairly self-explanatory, adding a new wheel object to your car (consider using a vector for this). An additional condition is that if you have already added the max number of wheels for the given vehicle (chassis size), the message “You’ve already added all the wheels!” should be displayed

• isBuilt() should return a Boolean as to whether or not the chassis and all wheels have been added to the vehicle.

• Drive() will give your car the ability to go for a test run. The integer it takes in should be the mileage you want the vehicle to travel. If the value entered is greater than the tire with the least mileage left, you should display the output “Broke Down!”. After every drive print “You’ve traveled x miles!” where x is the amount traveled. If you broke down, this value could be different from the value passed into the function. Additionally, make sure to change the condition of the wheels based on their mileage left. If above 10,000 they are good. If above 5,000 they are fair. Below that you have poor wheels. Keep in mind, a change in condition also means a change in price for the vehicle! Finally, if you attempt to drive the vehicle before it is built, the message “Vehicle not built. Literally un-drivable” should be displayed.

• getChassis() should just return the current vehicle’s chassis.

• Display() should display all the information of a vehicle and its associated chassis and wheels. Here is a sample output: Tips A few tips about this assignment:

• You can print out a tab character (the escape sequence ‘\t’) to help line up theoutput.

• Don’t try to tackle everything all at once. Work on one class at a time. Can’t have a Car without a Chassis.

• You can customize the way numbers are displayed in C++ (particularly floating-point numbers). The header file contains this functionality. Look into std::fixed andstd::setprecision()

Main class

#include “Vehicle.h”
#include “Wheel.h”
#include

int main()
{
Wheel plainWheel;

Chassis plainChassis(“medium”);
Vehicle firstCar(plainChassis);

for(int i=0; i < firstCar.getChassis().getNumWheels(); i++) {
firstCar.addWheel(plainWheel);
}

//since all plainWheels have been added, it should be built
if(firstCar.isBuilt()) {
std::cout << “Built!\n” << std::endl;
firstCar.Display();
}

Chassis superChassis(“large”,”good”);
Vehicle superCar(superChassis);

if(!superCar.isBuilt()) {
std::cout << “Where are the wheels!\n” << std::endl;
}

Wheel superWheel(“good”);

superCar.addWheel(superWheel);
superCar.addWheel(superWheel);
superCar.addWheel(superWheel);
superCar.addWheel(superWheel);

superCar.addWheel(plainWheel);
superCar.addWheel(plainWheel);

superCar.Display();
superCar.Drive(8000);
superCar.Display();

Wheel badWheel(“poor”);
Chassis reallyBadChassis(“small”, “poor”);
Vehicle badCar(reallyBadChassis);

for(int i=0; i < badCar.getChassis().getNumWheels(); i++) {
badCar.addWheel(badWheel);
}

badCar.Display();
badCar.Drive(6000);
badCar.Display();

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Project On Access 2013

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"
   

I need help on Project to access 2013.

I the person complete the instructions on pdf and theni need  the queries answer the below questions. Create a query for the following

  1. How many primary factor Alcohol related tickets issued in the database.
  2. Which primary factor has the least tickets and how many tickets are there
  3. Which primary factor has the most tickets and how many tickets are there
  4. Create a new query that identifies how many tickets M and F have, in other words who has the most ticket Male or Female

Access 2013 Chapter 3 Creating and Using Queries Last Updated: 2/27/15 Page 1

USING MICROSOFT ACCESS 2013 Independent Project 3-5

Independent Project 3-5 The State of New York Department of Motor Vehicles wants to create three queries. The first query provides summary data on the number of tickets by city and violation. The second query summarizes the total tickets by violation. The third query provides summary data for the total fines assessed against each driver who has had a ticket. To ensure consistency, the starting file is provided for you. Use Design view to create the summary queries. Edit the queries to add fields, aggregate functions, and sorting. Finally, save and run the queries.

Skills Covered in This Project  Create a summary query in Design view.

 Edit a query in Design view.

 Add fields to a query.

 Execute a query.

 Save a query.

 Sort query results.

 Add aggregate functions.

1. Open the NewYorkDMV-03.accdb start file.

2. The file will be renamed automatically to include your name. Change the project file name if

directed to do so by your instructor, and save it.

3. If needed, enable content in the security warning.

4. Create a new summary query in Design view. The

query counts the number of tickets issued by city

and violation.

a. Add the Ticket table into the Query

Design window.

b. Increase the size of the table object to

display all of the fields.

c. Add the following fields into the query: City,

PrimaryFactor, and TicketNumber.

d. Add the Total row to the query.

e. Group By the City and PrimaryFactor fields

and Count the TicketNumber field.

5. Save the query as

TicketCountByCityAndFactor.

6. Run the query. The datasheet should display

20 records.

7. Widen the field column widths to the Best Fit

(Figure 3-104).

8. Save the changes to the query.

9. Save a copy of the query as

TicketCountByFactor.

10. Edit the TicketCountByFactor query in Design

view. The query should show the total tickets

issued for each violation factor, sorted in

descending order by count.

a. Delete the City field.

b. Sort the TicketNumber field in

descending order.

11. Save and run the query. The datasheet should

match Figure 3-105.

Step 1

Download start file

Access 2013 Chapter 3 Creating and Using Queries Last Updated: 2/27/15 Page 2

USING MICROSOFT ACCESS 2013 Independent Project 3-5

12. Close the query.

13. Create a new summary query in Design view. The query provides summary data on the total fines

assessed against

each driver.

a. Add both tables into the Query

Design window.

b. Increase the size of the table

objects to display all of the fields.

c. Add the following fields into the

query: LicenseNumber,

FirstName, LastName, Fine, and

TicketNumber.

d. Add the Total row to the query.

e. Group By the LicenseNumber,

FirstName, and LastName fields,

Sum the Fine field and Count the

TicketNumber field.

f. Sort the Fine field in descending

order.

14. Save the query as TicketsByDriver.

15. Run the query. The datasheet should

display 21 drivers who have received

tickets, sorted in descending order

by the total dollar amount of their

fines (Figure 3-106).

16. Save and close the database.

17. Upload and save your project file.

18. Submit project for grading. Step 3

Grade my Project

Step 2

Upload & Save

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

PhD TIM-Formulate A Cloud Energy Efficiency Problem Statement

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"
   


Report Issue

  • Chen, F., Grundy, J., Yang, Y., Schneider, J.-G., & He, Q. (2013). Experimental Analysis of Task-based Energy Consumption in Cloud Computing Systems. Proceedings of the 4th ACM/SPEC International Conference on Performance Engineering (pp. 295-306). New York, NY: ACM. http://www.ict.swin.edu.au/personal/jgrundy/papers/icpe2013
  • Chu, F.S., Chen, K.-C., & Cheng, C.-M. (2011). Toward Green Cloud Computing. Proceedings of the 5th International Conference on Ubiquitous Information Management and Communication (p. Article 31). New York, NY: ACM. pp. 1-5
http://dx.doi.org.proxy1.ncu.edu/10.1145/1968613.1968651
  • Shrimali, B., & Patel, H. (2015). Performance Based Energy Efficient Techniques For VM Allocation in Cloud Environment. Proceedings of the Third International Symposium on Women in Computing and Informatics (pp. 477-486). New York, NY: ACM.
http://dx.doi.org.proxy1.ncu.edu/10.1145/2791405.2791446

Instructions

Read and critically analyze the week’s assigned readings related to the challenges and issues that exist within the energy efficiency space. Select a technical challenge, issue, consideration, or other topic from this week’s readings—or from last week’s research—that is an open research question that requires additional research to address. Write a problem paper in which you address the items below.

  • What is the problem that should be addressed with additional research (i.e., what is going wrong?)? Support the existence of the problem with references to recent scholarly literature.
  • What is the impact of the problem? That is, how are the victims (field of study, researchers, practitioners, industry, civilians, etc.) negatively affected by the problem, when is the problem evident, and where does the issue exist or become obvious? Provide an example of the problem in action or as experienced by those affected by it. Support the impact of the problem with references to recent scholarly literature.
  • Why does the problem exist? Discuss the conceptual basis, the nature of the problem, and outline of the problem as defined by the literature. Support underlying cause of the problem with references to recent scholarly literature.

Length: 5-7 pages, not including title page and reference

References: Support your assignment with a minimum of 9 scholarly references

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Implement American Option in C++

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"
   

Stevens Institute of Technology Assignment 1 FE 522 – C++ Programming in Finance Due Date: December 2, 2018

For every problem below, create a different project folder. You should then put all these folders inside a .zip file with your name before submitting everything in Canvas. Remember to delete all build and .vs folders before doing so (do not delete the .vscode folders). This .zip file should be accompanied by a .pdf file containing a report (one single report for the whole assignment). I do not provide test cases for any of the problems, and these must be provided by you. When providing a solution to a problem, you must be able to present test cases alongside it, otherwise it will not be accepted as a valid solution.

If a problem requires input and/or output files, please provide the whole file content (if not large) in the body of the report. If the file is too large to be pleasantly presented in a report (larger than a page), please provide a sample. You should include these files in folders named “input” and “output”, respectively, in the root folder of each project. In order for your code to work on any machine (not only yours), use relative paths to these files in your source code:

• for input files, use: “../../input/filename.txt”

• for output files, use: “../../output/filename.txt”

Problem 1 (2 points). Design and implement an AmericanOption class. It should hold information such as option type (call or put), spot price (of the underlying asset), strike price, interest rate, volatility (of the underlying asset) and time to maturity. Don’t accept illegal values. Implement a getPrice() function which gives the price of the option using a binomial tree defined as a matrix (vector< vector<double> >).

Hint: https://stackoverflow.com/questions/17663186/initializing-a-two-dimensional-stdvector

Problem 2 (2 points). Design and implement an Option class as the base class for both EuropeanOption and AmericanOption classes. It should contain all the member variables that are common between both option types, as well as a virtual function getPrice(). Moreover, it should contain four (non-virtual) functions to compute the numerical Greeks (getDelta() for spot price, getRho() for interest rate, getVega() for volatility, and getTheta() for time to maturity) of a given option. These functions should:

• Compute the price of the option by calling the virtual function getPrice();

• Apply a small bump to the required pricing factor (the size of the bump should be a parameter of the function);

• Compute the “bumped price” of the option by calling the virtual function getPrice();

1https://stackoverflow.com/questions/17663186/initializing-a-two-dimensional-stdvector

• Change the modified pricing factor back to its original value;

• Return the numeric approximation of the given Greek.

After all the above is done, implement an external function (to the class) which takes a Option& as parameter and compute all four Greeks in a row. Compare the results you obtain for American and European (call and put) options.

Problem 3. (2 points). Modify the Link class from sections 17.9 and 17.10 of the book to hold a value of an Option. Write a printAll() function that lists options with their attributes one per line. Add a member function addOrdered() that place its new element in correct (type, time to maturity, strike price)-order. Using Links with values of both EuropeanOption and AmericanOption, make a list of both call and put options to test your implementation.

Problem 4 (2 points). Modify the Link class from sections 17.9 and 17.10 of the book to be a template with the type of value as the template argument. Then redo Problem 3 with Link<Option>.

Problem 5. (2 points) In C, a string (often called a C string or a C-style string in C++ literature) is a zero-terminated array of characters. For example, p and q are equivalent:

char∗ p = ” asd f ” ; char∗ q = new char ( 5 ) ; q [ 0 ] = ’ a ’ ; q [ 1 ] = ’ s ’ ; q [ 2 ] = ’d ’ ; q [ 3 ] = ’ f ’ ; q [ 4 ] = 0 ;

In C, we cannot have member functions, we cannot overload functions, and we cannot define an operator (such as ==) for a struct. It follows that we need a set of (nonmember) functions to manipulate C-style strings:

(a) Write a function, char* strdup(const char*), that copies a C-style string into memory it allocates on the free store.

(b) Write a function, char* findx(const char* s, const char* x), that finds the first occurrence of the C-style string x in s.

(c) Write a function, int strcmp(const char* s1, const char* s2), that compares C-style strings. Let it return a negative number if s1 is lexicographically before s2, zero if s1 equals s2, and a positive number if s1 is lexicographically after s2.

Do not use any standard library functions. Do not use subscripting; use the dereference operator * instead.

Bonus (2 points). Design and implement a BarrierOption class that also inherits from Option. This time, however, the getPrice() function should compute the option price using Monte Carlo. Compute the Greeks for this kind of option.

2

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"