For this assignment, you will be creating classes with data members and methods.
The classes for each problem should be defined in a separate .h file with the implementation of methods in a separate .cpp file.
NOTE: Before submission, check to make sure your assignment does not have any cout statements
For this assignment, you will create a new project within CodeBlocks. You can name the project any name you like, but each problem has a specific file name to be used for the .h and .cpp files associated with the classes. See the individual problems for those names. Your project will contain 5 files total: main.cpp file, 2 .cpp files(one for each class), and 2 .h files(one for each class).
Once you have your code running on your virtual machine (VM), you must submit it to the autograder by zipping only the .h and .cpp files(not the main.cpp) for the
• created classes into a single file to be submitted. Youmust also submit your code(.zip) to Moodle to get full credit for the assignment.
Your upload file needs to be named Lastname_Firstname_Assignment7.zip for the grading script to run.Your classes will be included and accessed in the testing application’s main function.
If you do not get your assignment to run on COG before the assignment deadline, you will have the option of scheduling an interview grade with your TA to get a grade for the assignment. We’ll talk more about scheduling the interview in lecture and recitation. Even if you do get the assignment to run on COG, you can schedule the interview if you just want to talk about the assignment and get feedback on your
implementation. However, you must submit your code to Moodle to get credit for your program.
Submitting Your Code to Moodle:
You must submit your code to Moodle to get full credit for the assignment, even if the computer science autograder gives you a perfect score.
Please also include comments in your code submission to describe what your code is doing. Comments should also include your name, recitation TA, and the assignment and problem number. TAs will be checking that you code has comments and adequate indentation and variable names..
Problems:
These problems will require you to create a class description in a .h file and place all the code for implementing the classes into a .cpp file. You will need to write a main.cpp to hold your main() function that will test your classes. You will #include “yourfile.h” at the beginning of your main.cpp to define your class for use inmain() function.
REMEMBER: the code submitted to Moodle will be reviewed and up to a 20 point reduction will be assessed for poor coding style (lacking proper indentation, descriptive variable names, or required comments)
1. Quarterback Ratings
In football, there is a statistic for quarterbacks called the passer rating. There are five input parameters to the calculation: pass completions, pass attempts, total passing yards, touchdowns, and interceptions. The calculations required have been listed below.
You will create a class where the class description is placed in a file named
Quarterback.h and a file namedQuarterback.cpp will contain theimplementation of the methods for that class. COG will use these files to test your implementation of the class.
• Create a class called Quarterback that has the following private data members (all integer values except the string for name):
i. i. Quarterback Name
i. ii. Pass completions
i. iii. Pass attempts
i. iv. Total passing yards
i. v. Touchdowns
i. vi. Interceptions
class Quarterback
{
// data members private:
• // …
• // methods
public:
Quarterback(); Quarterback(string data);
• // access methods
string getName();
void setName(string new_name);
int getComp();
void setComp(int value);
int getAtt();
void setAtt(int value);
int getYards();
void setYards(int value);
int getTD();
void setTD(int value);
int getPick();
void setPick(int value);
• // add the required functions here
• // helper methods – only used by class methods private:
float calcC(); float calcY(); float calcT(); float calcI();
}
The class should have two constructors, one that takes no parameters, and one that takes a single string parameter that contains the values for each of the members listed above (in that same order) separated by a comma.
Data Format Example:
D. McNabb, 180, 316, 2647, 18, 6
The class must have access methods for both getting and setting the values of private members. There should also be a method for each variable to increment the values, which could be used in a simulated game. These methods do not return a value, only update the object’s data.
PassCompleted(int yards) — update comp, attempts, yards.
PassAttempted() — updates attempts.
Touchdown(int yards) — update comp, att, yards, touchdowns.
Interception() — updates attempts, interceptions
The class must have a method called PasserRating() that performs the following calculations and returns a float value:
C = (completions per attempt – 0.30) * 5
Y = (yards per attempt – 3) * 0.25
T = touchdowns per attempt * 20
I = 2.375 – (Intercepts per attempt * 25)
If C, Y, T, or I is less than 0, then set it to 0
If C, Y, T, or I is greater than 2.375, then set it to 2.375
PasserRating = (C+Y+T+I)/6*100
The class must have a method called Evaluation() which will return a subjective evaluation string based on the passer rating. A rating is “poor” if it is 85 or below, “mediocre” if above 85, “good” if above 90, and “great” if above 95.
To test your program, look up actual data onwww.nfl.comor http://www.pro-football-reference.com/years/2015/passing.htmoruse the following information from 2015:
|
Philip Rivers, 437, 661, 4792, 29, 13 |
93.8 |
|
Drew Brees, 428, 627, 4870, 32, 11 |
101.0 |
|
Tom Brady, 402, 624, 4770, 36, 7 |
102.2 |
COG will test your code by using both the string constructor and the default constructor in a simulated game (calling the incremental functions, then asking for a rating calculation).
2. Cycling: Power and Energy
This is a continuation of Assignment #3. See that assignment for all the equations. If you had the correct calculations in your solution for that assignment, you should be able to reuse the code here.
You will create a class where the class descriptions are placed in a file named BikeRacer.h and a file namedBikeRacer.cpp will contain theimplementation of the methods for those classes. COG will use these files to test your implementation of the classes.
Create a class called Racer. The class Racer will contain privatefloating point variables for data listed below. All these data members should be private, with publicaccess methods to get and set the values. Racer constructor will need to initialize all the member variables.
Mass of the bike in kg
Coefficient related to the resistance of the bike on the road
Mass of the rider in kg
Velocity in m/s
Coefficient related to rider position(K)
Coefficient of drafting
//Access methods Racer::setBikeMass(…) Racer::getBikeMass()
Racer::setBikeCR(…)
Racer::getBikeCR()
Racer::setRiderMass (…)
Racer::getRiderMass()
Racer::setCDraft(…)
Racer::getCDraft()
Racer::setK (…)
Racer::getK()
Racer::setVelocity (…)
Racer::getVelocity()
The power output for a cyclist (measured in Watts) can be calculated from the power needed to overcome air resistance and the power needed to
overcome rolling resistance. Write a method Power() for Racer to calculate the floating point value for power required per second based on current racer and racer’s bike settings.
Write a method to calculate the total power required to travel a given distance in kilometers. TotalEnergy(float distance) will return the floating point value for total energy as specified in the previous assignment’s write up.
Use the following values to test your classes:
Bike
M =15
Cr = 0.001
Racer
M = 63 k = 0.18 v = 10.8
CFdraft = 0.70
you should get 166.9 W
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
Our Services
Custom Writings Help is a Quality-Oriented Company in Online Writing as a result of hiring exceptional professionals to execute clients' tasks.
Essays
At Custom Writings Help,We understand the struggle of research paper writing, and that is why at Custom WritingS Help, we are all out to help you. We pride ourselves on having a team of clinical writers. The stringent and rigorous vetting process ensures that only the 'BEST' Writers are chosen for the job. We have highly qualified Ph.D. and MA writers working with us; we equally offer these experienced writers specific bonuses and incentives to make them deliver highly original, unique, and informative content at reasonably low prices.
Admissions
Thesis Writing Service
Worlwide, Many Masters Students are struggling with Thesis Completion. A thesis is likely to be the longest and most challenging piece of work a student has ever completed. However, unlike essays and other assignments, a student can pick a particular interest topic and work on their initiative. Fortunately, we are there for you. At Custom Writings Help, you are assured of an authentic, imaginative, informative, linguistically great, and advantageous thesis that adheres to all your needs. So, why continue considering different writers when you have discovered the best in the field?
Editing
Custom Papers
Not a single student can avoid writing custom papers. However, a total lack of experience, skills, and time makes it very hard to produce a superb writing piece. Therefore, if you are seeking professional help, turn to us. Our specialized and experienced writers compose a variety of model papers, including custom essays, college term papers, research papers, book reports, MBA essays, executive summaries, dissertations, Ph.D. theses, admission essays, and research proposals for college and university students at any level.
Coursework
Essay Writing
Most of the students disregard the critical principles of essay writing and compose papers below sensible guidelines. Therefore, with Custom Writings Help, one should not worry about his/her essay. Our Writers compose informative and engaging content on all complexities and topics. We write meaningful and smart essays while prioritizing all aspects that bring about a good grade, such as impeccable grammar, proper structure, zero-plagiarism, and conformance to guidelines.
Coursework
Coourse Work Writing
Don't let the seemingly never-ending onslaught of writing assignments get you down. If you are looking where to get course work assistance online, the writers at Custom Writings Help are here to assist you with all of your writing needs. We undertake to unique delivery of papers that meet the professor's requirements. The content is proofread, edited, and checked plagiarism before submission to customers. No matter how big or small your work is, we will deliver on time. Try US Now! !
Coursework
Dissertation Writing Service
High-Quality Dissertation Writing Services are rare. They require Ph.D. academicians – not easily found. However, are an exception. The years, time, and resources we have invested in the dissertation world has given us a competitive advantage over others. Choose to come to Custom Writings Help; You will find perfect Ph.D. consultants who have written hundreds of dissertations theses ready to help you. Let our dissertation-writing services help you craft your dissertation, for you are assured we will give you the results.