Question

Just need help solving this CSIS 123 Chapter 5 Controls Structures – Repetition/Looping Fall is football...

Just need help solving this

CSIS 123 Chapter 5

Controls Structures – Repetition/Looping

Fall is football season. For this assignment, you will be writing a football score board program using the looping structures that you learned in Chapter 5.

Initially, display a banner telling your user about the program.

Then, prompt them for the name of the home team and the visitor team

USING A FOR LOOP structure, prompt for the number of touchdowns and number of field goals for each team, for each of the four quarters of regulation play. Calculate and display the total number of points per quarter per team. Each touchdown is worth 7 points and field goals are worth 3.

At the end of four quarters, check to see if there is a clear winner or if the game is tied.

If you have a clear winner, display the final total scores and congratulate the winning team. Exit the program.

If tied after four quarters of play, display a message that you are going to overtime.

USING WHILE OR DO-WHILE LOOP, prompt again for the scoring events for the quarter, and then calculate and display the totals by team for that O/T period. The team will keep playing O/T quarters until there is a clear winner at the end of the quarter.

Once there is a winner, output final scores, congratulate the winner and exit the program.

Only Use C++ up to Chapter 5 in this ASSIGNMENT so only up to learning loops..

BEFORE YOU TURN IN YOUR ASSIGNMENT:

Be sure to TEST your program for both a clear winner in regulation play and a tie game/overtime situation.   Add lots of quality comments throughout your program. Include the program name, the date, and your name at the top, along with a short description of the purpose of the program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
#include <string>

using namespace std;

int main()
{
string home_team;
string visitor_team;
int homeT[10], homeF[10], visitT[10], visitF[10];
int homeOvT, homeOvF, visitOvT, visitOvF;
int homeTotal=0;
int visitorTotal=0;
cout << "***************************";
cout << "FOOTBALL SCORE BOARD";
cout << "***************************" << endl;
cout <<endl<< "Enter the name of the home team: ";
getline(cin, home_team);
cout << endl << "Enter the name of the visitor team: ";
getline(cin, visitor_team);
cout << endl;
  
//loop to get number of touchdowns and field goals for each team for 4 quarters
for (int i=0; i<4; i++) {
cout << "Enter number of touchdowns for "<<home_team<<" in quarter "<<(i+1)<<": ";
cin >> homeT[i];
cout << endl << "Enter number of field goals for "<<home_team<<" in quarter "<<(i+1)<<": ";
cin >> homeF[i];
cout << endl << "Enter number of touchdowns for "<<visitor_team<<" in quarter "<<(i+1)<<": ";
cin >> visitT[i];
cout << endl << "Enter number of field goals for "<<visitor_team<<" in quarter "<<(i+1)<<": ";
cin >> visitF[i];
}
  
//loop to calculate score for each quarter
for (int i=0; i<4; i++) {
cout << endl << "Total points for "<<home_team<<" in quarter "<<(i+1)<<": ";
cout << (homeT[i]*7)+(homeF[i]*3);
homeTotal = homeTotal+((homeT[i]*7)+(homeF[i]*3));
cout << endl << "Total points for "<<visitor_team<<" in quarter "<<(i+1)<<": ";
cout << (visitT[i]*7)+(visitF[i]*3);
visitorTotal = visitorTotal+((visitT[i]*7)+(visitF[i]*3));
}
  
//loop to check result
while (homeTotal == visitorTotal) {
cout <<endl<< "Final Scores!" << endl;
cout << "Home Team: "<<homeTotal <<endl;
cout << "Visitor Team: "<<visitorTotal <<endl;
cout << "We are going overtime!!!" <<endl;
cout << "Enter number of touchdowns for "<<home_team<<" for this quarter: ";
cin >> homeOvT;
cout << endl << "Enter number of field goals for "<<home_team<<" for this quarter: ";
cin >> homeOvF;
cout << endl << "Enter number of touchdowns for "<<visitor_team<<" for this quarter: ";
cin >> visitOvT;
cout << endl << "Enter number of field goals for "<<visitor_team<<" for this quarter: ";
cin >> visitOvF;
cout << "Score for home team for this quarter: "<<((homeOvT*7)+(homeOvF*3)) << endl;
cout << "Score for visitor team this quarter: "<<((visitOvT*7)+(visitOvF*3)) << endl;
homeTotal = homeTotal+((homeOvT*7)+(homeOvF*3));
visitorTotal = visitorTotal+((visitOvT*7)+(visitOvF*3));
}
  
if (homeTotal > visitorTotal) {
cout <<endl << "Final Scores!" << endl;
cout << "Home Team: "<<homeTotal <<endl;
cout << "Visitor Team: "<<visitorTotal <<endl;
cout << "Congratulations "<<home_team<<"!!!"<<endl;
}
  
else if (visitorTotal > homeTotal) {
cout << endl<<"Final Scores!" << endl;
cout << "Home Team: "<<homeTotal <<endl;
cout << "Visitor Team: "<<visitorTotal <<endl;
cout << "Congratulations "<<visitor_team<<"!!!"<<endl;
}
      
}

OUPUT 1:

***************************FOOTBALL SCORE BOARD***************************

Enter the name of the home team: ABC

Enter the name of the visitor team: XYZ

Enter number of touchdowns for ABC in quarter 1: 4

Enter number of field goals for ABC in quarter 1: 2

Enter number of touchdowns for XYZ in quarter 1: 5

Enter number of field goals for XYZ in quarter 1: 7
Enter number of touchdowns for ABC in quarter 2: 8

Enter number of field goals for ABC in quarter 2: 3

Enter number of touchdowns for XYZ in quarter 2: 6

Enter number of field goals for XYZ in quarter 2: 4
Enter number of touchdowns for ABC in quarter 3: 1

Enter number of field goals for ABC in quarter 3: 5

Enter number of touchdowns for XYZ in quarter 3:
8

Enter number of field goals for XYZ in quarter 3: 5
Enter number of touchdowns for ABC in quarter 4: 6

Enter number of field goals for ABC in quarter 4: 4

Enter number of touchdowns for XYZ in quarter 4: 7

Enter number of field goals for XYZ in quarter 4: 4

Total points for ABC in quarter 1: 34
Total points for XYZ in quarter 1: 56
Total points for ABC in quarter 2: 65
Total points for XYZ in quarter 2: 54
Total points for ABC in quarter 3: 22
Total points for XYZ in quarter 3: 71
Total points for ABC in quarter 4: 54
Total points for XYZ in quarter 4: 61
Final Scores!
Home Team: 175
Visitor Team: 242
Congratulations XYZ!!!

OUTPUT2:

***************************FOOTBALL SCORE BOARD***************************

Enter the name of the home team: ABC

Enter the name of the visitor team: XYZ

Enter number of touchdowns for ABC in quarter 1: 4

Enter number of field goals for ABC in quarter 1: 2

Enter number of touchdowns for XYZ in quarter 1: 5

Enter number of field goals for XYZ in quarter 1: 7
Enter number of touchdowns for ABC in quarter 2: 8

Enter number of field goals for ABC in quarter 2: 3

Enter number of touchdowns for XYZ in quarter 2: 6

Enter number of field goals for XYZ in quarter 2: 4
Enter number of touchdowns for ABC in quarter 3: 1

Enter number of field goals for ABC in quarter 3: 5

Enter number of touchdowns for XYZ in quarter 3:
8

Enter number of field goals for XYZ in quarter 3: 5
Enter number of touchdowns for ABC in quarter 4: 6

Enter number of field goals for ABC in quarter 4: 4

Enter number of touchdowns for XYZ in quarter 4: 7

Enter number of field goals for XYZ in quarter 4: 4

Total points for ABC in quarter 1: 34
Total points for XYZ in quarter 1: 56
Total points for ABC in quarter 2: 65
Total points for XYZ in quarter 2: 54
Total points for ABC in quarter 3: 22
Total points for XYZ in quarter 3: 71
Total points for ABC in quarter 4: 54
Total points for XYZ in quarter 4: 61
Final Scores!
Home Team: 175
Visitor Team: 242
Congratulations XYZ!!!

OUTPUT3:

***************************FOOTBALL SCORE BOARD***************************

Enter the name of the home team: ABC

Enter the name of the visitor team: XYZ

Enter number of touchdowns for ABC in quarter 1: 5

Enter number of field goals for ABC in quarter 1: 5

Enter number of touchdowns for XYZ in quarter 1: 5

Enter number of field goals for XYZ in quarter 1: 5
Enter number of touchdowns for ABC in quarter 2: 5

Enter number of field goals for ABC in quarter 2: 5

Enter number of touchdowns for XYZ in quarter 2: 5

Enter number of field goals for XYZ in quarter 2: 5
Enter number of touchdowns for ABC in quarter 3: 5

Enter number of field goals for ABC in quarter 3: 5

Enter number of touchdowns for XYZ in quarter 3: 5

Enter number of field goals for XYZ in quarter 3: 5
Enter number of touchdowns for ABC in quarter 4: 5

Enter number of field goals for ABC in quarter 4: 5

Enter number of touchdowns for XYZ in quarter 4: 5

Enter number of field goals for XYZ in quarter 4: 5

Total points for ABC in quarter 1: 50
Total points for XYZ in quarter 1: 50
Total points for ABC in quarter 2: 50
Total points for XYZ in quarter 2: 50
Total points for ABC in quarter 3: 50
Total points for XYZ in quarter 3: 50
Total points for ABC in quarter 4: 50
Total points for XYZ in quarter 4: 50
Final Scores!
Home Team: 200
Visitor Team: 200
We are going overtime!!!
Enter number of touchdowns for ABC for this quarter: 6

Enter number of field goals for ABC for this quarter: 6

Enter number of touchdowns for XYZ for this quarter: 6

Enter number of field goals for XYZ for this quarter: 6
Score for home team for this quarter: 60
Score for visitor team this quarter: 60

Final Scores!
Home Team: 260
Visitor Team: 260
We are going overtime!!!
Enter number of touchdowns for ABC for this quarter: 5

Enter number of field goals for ABC for this quarter: 3

Enter number of touchdowns for XYZ for this quarter: 7

Enter number of field goals for XYZ for this quarter: 2
Score for home team for this quarter: 44
Score for visitor team this quarter: 55

Final Scores!
Home Team: 304
Visitor Team: 315
Congratulations XYZ!!!

Add a comment
Know the answer?
Add Answer to:
Just need help solving this CSIS 123 Chapter 5 Controls Structures – Repetition/Looping Fall is football...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need just homework#6, I post homework# 5 to understand how to do it ? Please...

    I need just homework#6, I post homework# 5 to understand how to do it ? Please do it and please don't copy the answer CSCE 1030 Homework 5 Due: 11:59 PM on Monday, April 17,2017 PROGRAM DESCRIPTION: In this C++ program, you will start building the software infrastructure that will allow you to play a simplified version of the class game of Minesweeper that will display to the screen. In Homework 6, you will continue the work begun here to...

  • In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play...

    In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your program should have the following: •Make the name of the project RockPaperScissors•Write a method that generates a random number in the range of 1 through 3. The randomly generated number will determine if the computer chooses rock, paper, or scissors. If the number is 1, then the computer has chosen rock. If the number is...

  • INTRODUCTION: Play sorry with two die, and one peg. Move your piece down the board first....

    INTRODUCTION: Play sorry with two die, and one peg. Move your piece down the board first. But rolling certain numbers will change the pace of the game. INCLUDE IN YOUR ASSIGNMENT: Annotation is a major part of any program. At the top of each of your C++ programs, you should have at least four lines of documentation: // Program name: tictactoe.cpp // Author: Twilight Sparkle // Date last updated: 5/26/2016 // Purpose: Play the game of Tic-Tac-Toe ASSIGNMENT: Sorry Game...

  • I need that in Java CSCI 24000- Fall 2017 Assignment #3-Class-v Players Due: 10/9/2017 This third...

    I need that in Java CSCI 24000- Fall 2017 Assignment #3-Class-v Players Due: 10/9/2017 This third assignment will allow you to explore (by comparing and contrasting through construction and implementation) two different object-oncnted programman罨languages (C++ and Javal You will be creating tme scparate programs-onc written in C++ and on written in Java For this assignment, we are going to explore how we can use objects to build more expressive and cleaner programs. In honor of football season we are going...

  • Written in Python In this lab, you are to build a trivia game. The game should...

    Written in Python In this lab, you are to build a trivia game. The game should present each question – either in order or randomly – to the player, and display up to four possible answers. The player is to input what they believe to be the correct answer.   The game will tell the player if they got it right or wrong and will display their score. If they got it right, their score will go up. If they got...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming...

    Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then,...

  • For your Project, you will develop a simple battleship game. Battleship is a guessing game for...

    For your Project, you will develop a simple battleship game. Battleship is a guessing game for two players. It is played on four grids. Two grids (one for each player) are used to mark each players' fleets of ships (including battleships). The locations of the fleet (these first two grids) are concealed from the other player so that they do not know the locations of the opponent’s ships. Players alternate turns by ‘firing torpedoes’ at the other player's ships. The...

  • Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June...

    Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June 9th, 2018 @ 23:55 Percentage overall grade: 5% Penalties: No late assignments allowed Maximum Marks: 10 Pedagogical Goal: Refresher of Python and hands-on experience with algorithm coding, input validation, exceptions, file reading, Queues, and data structures with encapsulation. The card game War is a card game that is played with a deck of 52 cards. The goal is to be the first player to...

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT