Profile cover photo
Profile photo
Impel Tutors
4 followers -
Best Online One-on-One Tutoring
Best Online One-on-One Tutoring

4 followers
About
Posts

Post has attachment
C++ PROGRAMMING: SUPERHERO FIGHT

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 11: Superhero fight
Goal
Implement fights that can occur between Hero objects.
Setup
Since we’ll be revising Homework 10, it’s a GoodIdeaTM to duplicate your project
folder, rename it Homework11, and start with that folder.
Introduce a new pair of files: Powers.h and Powers.cpp. These files will contain
several class definitions. The Power abstract class and the six Power classes you will
implement.
Each file must begin with the in the following (replace the name and email with your
actual information):
// Name
//
// Homework 10
//
Use the input file “heroes.txt” included with Homework 10 as sample input to this
program. You will need several different files – one for each Hero.
Part 0: No more arrays
The first thing you’ll want to do is get rid of the arrays. Convert your Hero array and
powers array to vectors – unless you already have vectors. Then you can skip this part.
Part 1: Powers.h
This file has 4 sections:
1. Constant integers indicating power. Put these at the top of the file above all your
other code – but below your #includes.
2. A Power abstract class
3. Individual power classes (that inherit from the Power abstract class)
4. A powerFactory function that is not part of any class
For the constant integers, create 6 const int variables, each representing a different
Power. These will be used as the IDs for the Power classes. This will allow us to use
these variable names instead of just numbers. It will make your code easier to read
and to write. The different powers are:
1. Flight (example: const int FLIGHT_POWER = 1;)
2. Gadgets
3. Intelligence
4. Laser
5. Nationalism
6. Strength
The Power abstract class is to have the following:

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: SUPERHERO LISTING

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 10: Superhero listing
Goal
Using an input file with specially formatted information about some superheroes, you will generate several Hero objects and display a roster of the loaded heroes.
Setup
Create a new project in Visual Studio or Xcode called homework10 and new C++ files
named Driver.cpp, Hero.h and Hero.cpp. Driver.cpp will contain the main function and
related functions. The Hero files will contain a class called Hero.
Each file must begin with the in the following (replace the name and email with your
actual information):
// Name
//
// Homework 10
//
Use the input file “superman.txt” included with this assignment file as sample input to
your program. Note: this is only sample input and may be different from the input we
use to test your program when grading.
Part 0: Understanding the input file
Your program will accept an input file. Each hero input file has the information about a single hero. The format of the file is:
Line 1: Hero’s name
Line 2: Hero’s health
Line 3: One, or more, powers separated by a space
The powers are to be stored in your Hero class as an array of std::strings. The number of powers per hero is at least 1, but no more than 10. A sample input file is:
Superman
5
strength flight laser
Where Superman is the name, the 3 powers are strength, flight, and laser, and the starting health is 5.
Part 1: Hero class
Create a class called Hero. It has 4 private member variables:
1. An int that represents the hero’s maximum health.
2. An int that represents the hero’s current health.
3. A std::string that holds the hero’s name.
4. An array that holds std::string variables that list each power for the hero.
The Hero class also has the following public member functions:

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: COMPANION PET 2.0

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming

Homework 9: Companion Pet 2.0

Goal
In this homework you will be upgrading your animal class from homework 8. You will be implementing the same class, but now separated into a header file and an implementation file. Also, you will adding more fun traits and interactions to your animal class. Included with this assignment is the file “FileIO.h” which includes functions to help implement the file input and output needed in this assignment.

Setup
Create a new project in Visual Studio or Xcode called hw09 and add three new files named hw09.cpp, Animal.h, and Animal.cpp. Then add the given FileIO.h file to your project.
Each file must begin with the following (replace the name and email with your actual
information):
// Name
//
// Homework 9
//
You may use the input file “Animal.txt” included with this assignment file as sample input to your program.

Part 1: Animal class – Animal.h and Animal.cpp
Create a class named after your favorite animal. This write-up will use the Dog class as an
example, but you can use any other animal you’d prefer.
The class now has 6 private member variables:
o An int to hold the animal’s hunger meter.
o An int to hold the animal’s happiness meter.
o An int to hold the animal’s health meter.
o An int to hold the animal’s energy meter.
o An int to hold the animal’s age.
o A std::string to hold the name of the pet animal.
The class also has the following public member functions:
o A default constructor that sets the hunger, happiness, health, and energy of the animal
to 50, the age to 0, and the name to “No Name”.
o A non-default constructor that takes in a parameter for each private member variable,
and sets each variable with the parameter values. Make sure to only allow the range of
[0-100], inclusive, for the integer member variables.
o A setter and getter for each private member variable. These do not need to have the
typical function header comments, but they should restrict the integers to the range of
[0-100], inclusive.
o A Play function that returns nothing, and accepts nothing as input. It will increase the
animal’s happiness by 10 and increase the hunger by 5.

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: COMPANION PET

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 8: Companion Pet
Goal
In this homework you will be getting practice with file input and output and, in the process, will be creating a basic and fun companion pet to play with via classes.
Setup
Create a new project in Visual Studio or Xcode called hw08 and a new C++ file named hw08.cpp.
Each file must begin with the following (replace the name and email with your actual information):
// Name
//
// Homework 8
//
You may use the files “Dog.txt”, “StarvingDog.txt”, and “SadDog.txt” included with thisassignment file as sample input for testing your program, or you may create your own text files.
Part 1: Animal class
Create a class named after your favorite animal. This write-up will use the Dog class as an example, but you can use any other animal you’d prefer. It has 3 private member variables:
The class also has the following public member functions:
o An int to hold the animal’s hunger meter.
o An int to hold the animal’s happiness meter.
o A std::string to hold the name of the pet animal.
o A setter for the happiness member variable
o A getter for the happiness member variable
o A setter for the hunger member variable
o A getter for the hunger member variable
o A setter for the name member variable
o A getter for the name member variable
o A PrintStats function that returns nothing, and accepts nothing as input. It
should display the name, health, and happiness of the animal.
o A Play function that returns nothing, and accepts nothing as input. It should display
a playful message to the console, then also increase the animal’s happiness by 10
and hunger by 5.
o A Feed function that returns nothing, and accepts nothing as input. It should
display a tasty message to the console, then also decrease the animal’s hunger by 10.
Be sure to comment your public member functions (but NOT the getters and setters) as discussed in lecture.
It is advised to now test your class in main. Be sure to test every function. I would recommend changing the data of a test object and displaying the values to the console to see if your functions are working properly.

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: HIGH-CARD SIMULATOR

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 7: High-card simulator
Goal
For this assignment, you’ll be creating a simulator for an exciting game of High-Card. 2 players randomly pick 2 cards from two different decks. Whoever gets the highest rank (suit doesn’t matter), wins the round. You’ll run the simulator until the user asks for the excitement to stop.
Setup
Create a new project in Visual Studio or Xcode called hw07 and a new C++ file named hw07.cpp.
Your hw07.cpp file must begin with the following (replace the name and email with your actual information):
// Name
//
// Homework 07
//
Part 1: Struct setup
Create a struct called Card. It has 2 pieces of data:
o An int to hold the card’s rank – a number from 2 to 14. Where 11 represents a
Jack, 12 is a Queen, 13 is a King, and 14 is an Ace.
o A std::string to hold the card’s suit. Suits can be Diamonds, Clubs, Hearts, or
Spades.
Write main that, for now, makes a variable of type Card, just to test everything.
Part 2: cardToString function
Create a function called “cardToString”. It should accept 1 Card variable for input and return a std::string. This function will examine the inputted card and generate a string containing something like “2 of Clubs” or “Queen of Diamonds”.
I recommend creating a std::string to hold the return value.
If the card rank is between 2 and 10, you can set the return value to contain the starting number like “5” or “10”.
If the card rank is between 11 and 14, you’ll need to decode the rank to Jack, Queen, King, or Ace.
Next, add the suit of the Card variable to the return value and return that new std::string.
For now, inside of main, create a new Card variable for testing the cardToString function. Set
the card’s rank and suit to your favorite playing card value.
You should be able to display out that card’s information with code similar to: std::cout << cardToString(testCard) << std::endl;
Be sure to test your function with several Card values/variables.
Part 3: makeCard function
Create a function called “makeCard”. Its job is to create Card variables for us. It accepts 2 input:

Contact us at *http://www.impeltutors.com/* for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: TIC-TAC-TOE

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 6: Tic-Tac-Toe
Goal
For this assignment, you will be making a game! You will be implementing the two-player game Tic-Tac-
Toe. Part of the logic has been taken care of for you and provided to you in the form of an already
started .cpp file. You will be filling in the missing code for one function and creating another from
scratch. This assignment will give you practice with calling and creating functions that have input and
return values.
Setup
. Create a new project in Visual Studio or Xcode called hw06 and add the existing file named
hw06.cpp to your project. The file is included with your homework write-up on Blackboard.
. Your hw06.cpp file must begin with the following (replace the name and email with your actual
information):
// Name
//
// Homework 06
//
Part 1: PrintBoard function
. To begin, you will be making a function to display the game board. Be sure to include the
function header comments to document the name, purpose, parameters, and return of the
function.
. This function will be called PrintBoard and will return nothing. It has one input parameter of a
character array that is meant to hold the game board.
o This function will display a 3x3 grid and outputs every element of the character array in
the corresponding grid spot.
o You may assume we will always have a size 9 array (the typical number of spaces on a
Tic-Tac-Toe game board).
. Now you need to test your function in main. Create a char array of size 9 initialized with the
characters 1-9.
. Next, call the newly implemented PrintBoard function with the char array from main as an
input parameter to display the game board and test your function.
. Your output in Part 1 should look something like:
1 | 2 | 3
------------
4 | 5 | 6
------------
7 | 8 | 9
Press any key to continue...
Contact us at http://www.impeltutors.com/ for the solution.
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: MORSE CODE

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 5: Morse code
Goal
We want to prepare you for emergencies. So this week you’ll write your own Morse code
generator. Morse code is internationally recognized for communicating basic messages. It is
very robust as messages are able to be sent over very poor quality and primitive lines of
communications. We will generate 2 types of Morse code messages, visual and audio.
Wikipedia has a good article on Morse code if you want more background.
For visual messages we’ll turn user text into dashes (represented with hyphens) and dots
(represented with periods). For audio messages, we’ll use functions from the Sound.h file
included with the assignment.
Setup
• Create a new project in Visual Studio or Xcode called hw05 and a new C++ file named hw05.cpp.
• Copy the file Sound.h into the folder as your file hw05.cpp.
• Your hw05.cpp file must begin with the following (replace the name and email with your actual information):
// Name
//
// Homework 05
//
‪#‎include‬ "Sound.h"
Notice that the 1st line of code is the #include "Sound.h". This must come before any
other code in your file (including other #include lines).
• Because we’ll be using the sound system again, we will not loop the program. Meaning
you cannot play the sounds more than once. What’s more, you must wait for all sound
to stop AND close any media players before you can run the program again.
• Finally, we will be using std::getline throughout this assignment again. Do not use
“std::cin >> input;” anywhere please.

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: MYERS BRIGGS PERSONALITY TEST

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 3: Myers Briggs Personality Test
Goal
For this homework assignment you will help me implement one dimension of the Myer-Briggs personality test. This will give you practice working with loops and arrays. We’ll be determining if you are an extrovert or an introvert. For more information on the test and results, please visit: http://www.humanmetrics.com/personality/type. This link also includes a free, full version of the test.
Requirements
. Create a new project in Visual Studio or Xcode titled hw03, and
a new C++ file named hw03.cpp.
. Your hw03.cpp file must begin with comments in the following
format (replace the name/email with your actual information):
// Name
//
// Homework 03
//

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
C++ PROGRAMMING: NUMBER BASE CONVERSION

Contact us at http://www.impeltutors.com/ for the solution

ITP 165: Introduction to C++ Programming
Homework 3: Number Base Conversion
Goal
For this homework assignment you will be taking a character from the ASCII table and converting it first
into binary, then into hexadecimal. The ASCII table will be an important reference to check the accuracy
of your conversion calculations. You will also be checking if the resulting binary number is a palindrome.
A palindrome is a sequence of characters that reads the same backwards and forwards, for instance the
word “RACECAR” or the binary number “01000010”.
Requirements
. Create a new project in Visual Studio or Xcode titled hw04, and a new C++ file named hw04.cpp.
. Your hw04.cpp file must begin with comments in the following format (replace the name/email with your actual information):
// Name
//
// Homework 04
//

Contact us at http://www.impeltutors.com/ for the solution
Photo
Add a comment...

Post has attachment
Photo
Add a comment...
Wait while more posts are being loaded