Question
I need some help with my week 3 lab Here are the instructions and my code i have is at the bottom of the instructions,
I need some help with my week 3 lab Here are the instructions and my code i have is at the bottom of the instructions, the instructions have to be read in order for it to make sense. Please leave comment if you have questions i would like to get this done to today.
Step 1
Create a C++ project, and call it Week 3overloading Wings.
Create a Wings class using a separate header file and implementation file.
Add the following attributes.
Flavor (string data type)
numPieces (short data type)
Create a single constructor that uses default arguments.
Flavor should be set to unknown if it is not given.
numPieces should be set to 0 if it is not given.
Create a destructor for the class.
Create accessors and mutators for the attributes.
Step 2
Overload the following operators in the Wings class.
Operator | Description | Example |
---|---|---|
+ | addition | wings3 = wings1 + wings2; |
- | subtraction | wings3 = wings1 - wings2; |
- | negation | wings2 = -wings1; // negative |
++ | pre-increment | ++wings; |
++ | post-increment | wings++; |
= | assignment | wings2 = wings1; |
>> | input stream operator | cin >> wings; |
<< | output stream operator | cout << wings << endl; |
Create a main method for your application that tests each of your overloaded operators.
Run your program, and test it. Do the Wings objects add together logically? Do they increment appropriately? Can you display the Wings objects using simply output statements?
Put a breakpoint at the top of your main method, and step through your
code. Remember to use Step Out if you accidentally step into the C++ code library. Can you see how your application works?
Create a Microsoft Word document called Week 3 Lab. At the top, put your information, including your name, course, Week 3 Lab, and the date.
Run your application. Take screenshots while your application is running to demonstrate that it works properly. Remember to hold down the Alt key and the PrtScrn key at the same time (Alt + PrtScrn) to take screenshots of the active window only. Paste these screenshots into your Word document.
Put the file name for each file in the Word document below the screenshots. Bold the file name, and increase the font. Copy and paste the code for each file below its file name. You should have three files for your project.
Submit the Word document to the Week 3 Lab page underneath Assignments.
Here is code i have so far
**********************************************************************************************************************************************************************************************
Source. Cpp code
/*
Will Solomon
Week 3 iLab
*/
#include
#include
#include
#include "wings.h"
using namespace std;
//Entry point to the application
int main()
wings w = new wings();
///pause
cout << " Press any keey to continue...";
_getch();
return 0;
}
************************************************************************
Wings. Cpp
#include "Wings.h"
//constructors
wings::Wings(string flavor = "unknown", short numberOfPieces = 0)
{
}
wings::~Wings()
{
}
// accessors and mutators
string wings::getFlavor()
{
return "";
}
void wings:: setFlavor (string flavor)
{
}
short wings:: getNumberOfPieces(string flavor)
{
return 0;
}
void wings::setNumberOfPieces(short numberOfPieces)
{
}
wings::wings(string flavor, short numberOfPieces)
{
}
Wings.h
#pragma once
#include ;
using namespace std;
class wings
{
private:
// attribute
string flavor;
short numPieces;
public:
//constructors
wings(string flavor = "unknown", short numberOfPieces = 0);
~wings();
Wings::Wings(string flavor, short numberOfPieces);
~Wings();
string getFlavor();
void setFlavor(string flavor);
short getNumberOfPieces(string flavor);
void setNumberOfPieces(short numberOfPieces);
};
// accessors and mutators
string wings::getFlavor()
{
return "";
}
void wings::setFlavor(string flavor)
{
}
short wings::getNumberOfPieces(string flavor)
{
return 0;
}
void wings::setNumberOfPieces(short numberOfPieces)
{
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started