Question
1.Using the program as given, run it with input integers that cause it to produce incorrect, unusual, or nonsensical results. (Notice we're saying to try
1.Using the program as given, run it with input integers that cause it to produce incorrect, unusual, or nonsensical results. (Notice we're saying to try input integers, not input like 124765.23 or strawberry.)
2.Starting from the program as given, introduce into the source code at least one error that someone might make that, while not preventing a successful build, causes the program when it runs to produce incorrect results from reasonable input.
3.Again starting from the program as given, introduce at least two distinct types of mistakes that someone might make, each of which would cause the program to fail to compile correctly.
What do these mean?
This is the code we are given:
// // Code for Project 1 // Summer Fun #include#include using namespace std; int main() { // Senate seats prior to the 2022 Elections const int CURRENT_DEMOCRATS_NOT_UP_FOR_ELECTION = 36; const int CURRENT_REPUBLICANS_NOT_UP_FOR_ELECTION = 29; int demoCount = 0; int repCount = 0; int total = 0; cout << "In the 35 Senate seats up for election in 2022,"; cout << endl; cout << " how many went for Democrats? "; cin >> demoCount; cout << " how many went for Republicans? "; cin >> repCount; total = CURRENT_DEMOCRATS_NOT_UP_FOR_ELECTION + CURRENT_REPUBLICANS_NOT_UP_FOR_ELECTION + demoCount + repCount; if (CURRENT_DEMOCRATS_NOT_UP_FOR_ELECTION + demoCount >= CURRENT_REPUBLICANS_NOT_UP_FOR_ELECTION + repCount) { cout << "Looks like the Senate will be controlled by Democrats"; cout << endl; } else { cout << "Looks like the Senate will be controlled by Republicans"; cout << endl; } if (total != 100) { cout << "Something looks awry with the numbers..."; cout << endl; } return(0); }
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