(Solved) : Test 3 Part B Consists Three Tasks Debug Modify Program C Due 11 26 19 Please Note Well Te Q42692768 . . .

Test 3 Part B consists of three tasks: Debug and Modifya program. (C++)

DUE 11/26/19

Please note that to do well on Test 3 both Part A and Part Bmust be completed.

  1. Debug, (find the errors and correct them in),the program, T3DebugProg.cpp (worth 20points):

Note:

  1. The file is attached with this part of the test – downloadit.
  2. Note that there are 6 errors.
  3. For debug assignments — Overall Assignment worth 2 points:
    1. DO NOT take out comments
    2. DO NOT rearrange the code!
    3. DO NOT change the code standards!
  4. Each error you find is worth 3 points for 18points total.  
    1. Find the bug
    2. Fix the bug
    3. Document the bug in the code to make it easy to fine
    4. You will lose points for incorrectly fixingthe bug.
  5. The program should run correctly when you have found andcorrected all 6 errors. Some are syntax andsome are logic errors.
  6. Submit both source code (*.cpp file),output files and screen print of runningprogram.

// Test Scores Debug // Debug Program — there are 6 errors in this program// Correct this program#include <iostream>#include <iomanip>using namespace std; void readData(ifstream& inputFile, int list[], int size);void holdscrn( ); // void function to hold screen open before exitint main(){ int scores[8] = {0}; ifstream infile; infile.open(“TestScoresData.txt”); if (infile) { cout << “Cannot open the input file. Program terminates!” << endl; holdscrn( ); // Hold screen before exit return 1; } readData(infile, scores, 8); print(scores, 8); cout << endl; infile.close(); holdscrn( ); // Hold screen before exit return 0;}void readData(ifstream& inputFile, int list[], int size){ int score; int index; cin >> score; while (inputFile) { index = score / 25; if (index == size) index–; if (index < size) list[index]++; inputFile >> score; } return 0;}void print(int list[], int size){ int range; int lowRange = 0; int upperRange = 24; cout << ” Range # of Students” << endl; for (range = 0; range < size; range++) { cout << setw(3) << lowRange << ” – ” << upperRange << setw(15) << list[range] << endl; lowRange = upperRange + 1; upperRange = upperRange + 25; if (range == size – 2) upperRange++; } cout << endl; return;}void holdscrn( ) // void function to hold screen open before exit{ char holdscreen; cout << “nntEnter one character and press return to exit program: “; cin >> holdscreen; return;}

Test Scores: Data

76 89 150 135 200 76 12 100 150 28 178 189 167 200 175 150 87 99 129149 176 200 87 35 157 189

  1. Modify the program (worth 20points)(C++):

Modify the Chapter 10Programming Example Abstract Creature program toadd the following:

  • Add three more characters:   Human,Elf and Dwarf
  • Expand Orc to 3 Types ofOrcs: Minion, Warrior, and Boss
  • Expand the Main to include a menu to greet allthe 3 alternate characters and the 3different types of Orcs.

Required for program grade:

  1. Source Code (complete)
  2. Screenshot of running program.
  3. Note partial credit will be givenfor incomplete programs that show progress from the originalprogram.

//Abstract Creature//Demonstrates abstract classes#include <iostream>using namespace std;class Creature //abstract class{public: Creature(int health = 100); virtual void Greet() const = 0; //pure virtual member function virtual void DisplayHealth() const;protected: int m_Health;};Creature::Creature(int health): m_Health(health){}void Creature::DisplayHealth() const{ cout << “Health: ” << m_Health << endl;}class Orc : public Creature{public: Orc(int health = 120); virtual void Greet() const;};Orc::Orc(int health): Creature(health){}void Orc::Greet() const{ cout << “The orc grunts hello.n”;}int main(){ Creature* pCreature = new Orc(); pCreature->Greet(); pCreature->DisplayHealth(); return 0;}

Expert Answer


Answer to Test 3 Part B consists of three tasks: Debug and Modify a program. (C++) DUE 11/26/19 Please note that to do well on Te…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us