(Apply) Students will write a function and loop to iterate until a condition is met LO: (Analyze) Students will identify edge cases from a problem statement. In this game of volleyball, two teams compete to be the first team to score 21 points. However, to win the game, a team must also lead by two points. For example, if team A is tied with team B (20-20) and then scores, they will only be ahead by one point (21-20). Then, if team B scores a point, the game will be tied again (21-21). Then, if either team can score two consecutive points, they will win. Write a program that reads data about volleyball matches from standard input and then determines the outcome of the game. If the input word is "A" it means that team A scored a point. If the input word is "B" it means that team B scored a point. If the input word is "end" it means that the game ended. Write a function that can be used in a loop as part of the condition. It should evaluate if either team is a winner. Call the function weHaveAWinner. In main, calculate the scores and announce the team that won or that the game was a draw. Display the game result in this format:
Team A won! (21-14)
Game ended as a draw. (21-21)
#include
using namespace std;
/*
* Determines the outcome of a volleyball game.
*/
int main() {
return 0;
}

Answers

Answer 1

Answer:

The program is as follows:

#include<iostream>

using namespace std;

void weHaveAWinner(int A, int B){

   if(A-2>=B){

       cout<<"Team A won! ("<<A<<"-"<<B<<")";    }

   else if(B-2>=A){

       cout<<"Team B won! ("<<A<<"-"<<B<<")";}

   else if(B == A){

       cout<<"Game ended as a draw. ("<<A<<"-"<<B<<")";}

   else{

       cout<<"Team A: "<<A<<" - Team B: "<<B;}

}

int main() {

   int teamA = 0;    int teamB = 0;

   string score;

   cout<<"Score: "; cin>>score;

   while(score != "end"){

       if(score == "A"){

           teamA++;}

       else if(score == "B"){

           teamB++;}

       cout<<"Score: "; cin>>score;

   }

   weHaveAWinner(teamA,teamB);

   

return 0;

}

Explanation:

This defines the weHaveAWinner function, which receives the scores of both teams as its parameters  

void weHaveAWinner(int A, int B){

This checks if team A score at least 2 more than team B. If yes, it declares team A the winner

   if(A-2>=B){

       cout<<"Team A won! ("<<A<<"-"<<B<<")";    }

This checks if team B score at least 2 more than team A. If yes, it declares team B the winner

   else if(B-2>=A){

       cout<<"Team B won! ("<<A<<"-"<<B<<")";}

This checks for a draw

   else if(B == A){

       cout<<"Game ended as a draw. ("<<A<<"-"<<B<<")";}

This checks if both team are within 1 point of one another  

 else{

       cout<<"Team A: "<<A<<" - Team B: "<<B;}

}

The main begins here

int main() {

This declares and initializes the score of both teams to 0

   int teamA = 0;    int teamB = 0;

This declares score as string

   string score;

This prompts the user for score

   cout<<"Score: "; cin>>score;

This loop is repeated until the user inputs "end" for score

   while(score != "end"){

If score is A, then teamA' score is incremented by 1

       if(score == "A"){

           teamA++;}

If score is B, then teamB' score is incremented by 1

       else if(score == "B"){

           teamB++;}

This prompts the user for score

       cout<<"Score: "; cin>>score;

   }

This calls the weHaveAWinner function at the end of the loop

   weHaveAWinner(teamA,teamB);


Related Questions

Pls awnser right awnsers only

Answers

Answer:

2, 4, and 5

Explanation:

The third assignment involves writing a Python program to compute the cost of carpeting a room. Your program should prompt the user for the width and length in feet of the room and the quality of carpet to be used. A choice between three grades of carpeting should be given. You should decide on the price per square foot of the three grades on carpet. Your program must include a function that accepts the length, width, and carpet quality as parameters and returns the cost of carpeting that room. After calling that function, your program should then output the carpeting cost.
Your program should include the pseudocode used for your design in the comments. Document the values you chose for the prices per square foot of the three grades of carpet in your comments as well.
You are to submit your Python program as a text file (.txt) file. In addition, you are also to submit a test plan in a Word document or a .pdf file. 15% of your grade will be based on whether the comments in your program include the pseudocode and define the values of your constants, 70% on whether your program executes correctly on all test cases and 15% on the completeness of your test report.

Answers

Answer:

# price of the carpet per square foot for each quality.

carpet_prices=[1,2,4]

def cal_cost(width,height,choice):

 return width*height*carpet_prices[choice-1]  

width=int(input("Enter Width : "))

height=int(input("Enter Height : "))

print("---Select Carpet Quality---")

print("1. Standard Quality")

print("2. Primium Quality")

print("3. Premium Plus Quality")

choice=int(input("Enter your choice : "))

print(f"Carpeting cost = {cal_cost(width,height,choice)}")

Explanation:

The cal_cost function is used to return the cost of carpeting. The function accepts three arguments, width, height, and the choice of carpet quality.

The program gets the values of the width, height and choice, calls the cal_cost function, and prints out the string format of the total carpeting cost.

The _____________computer function accepts data from input devices and sends it to the computer processor.

Question 9 options:

Input


Memory


Storage


RAM

Answers

Answer: input

Explanation:

The computer function that accepts data from the input devices and sends it to the computer processor is refered to as the input function.

The input device is referred to as a hardware device which is used in sending data to a computer. Some examples of input devices that we have keyboard, mouse etc.

identify the web browser used in your school lab or at home.why do you think there need to be more than one browser.​

Answers

Answer:

Chrome, Edge, and Firefox.

Explanation:

Utilizing different browsers make sense depending upon websites that you are using. Not every site is optimized for one standard browser. Also, Microsoft has discontinued supporting their Internet Explorer browser. That means they no longer update, share security patches, or support it. Some websites or software works better with the Chrome browser, while it is not optimized for others. When looking at websites using Firefox, if the site isn't optimized for it, the site layout will not be easily read or used. Clicking on links on the browser can cause errors or a malfunction. A variety of coders, software authors or companies create sites or software using different code and algorithms. That is the basis of differences in site and software functionality.

Match the tasks with the professionals who do them.

Answers

Answer:

purchasing agent: negotiate contracts with suppliers

attend conferences and trade shows to find new products

office clerk: file paperwork according to a filing system in the office

type data into software to be used by the company

freight forwarder: calculate the weight and volume of cargo

track shipments to make sure that they arrive on time

True or False
4. The Timeline is a window at the bottom of the Stage which is divided into frames.​

Answers

Answer:

I think the answer is true

( PLZ HELP I WILL MARK MOST BRAINLIEST) A city is facing shortfall and may have to raise taxes before taking this step the mayor decides to form a task force of his supporters and opponents to study the issue and recommend solutions ,
What leadership qualities do the mayors actions demonstrate.

A. Collaboration
B. Time management skills
C. Effective communication
D. Following others

Answers

Answer:

collaboration

Explanation:

the mayor is working together with people and to make it have better sense an example would be the slang word collab that singers use when making a song together

Answer:

A. Collaboration

Explanation:

First off, I will explain why the other answers are incorrect. There is no discussion about time and how it is incorporated into the situation, so the answer cannot be "B.". "D." is not correct because the mayor is not following, he is leading. And "C." cannot be correct as the process hasn't even started yet. "A." IS the answer because the mayor is working together with other experts to help solve the situation.

which of the view will show you a view very similar to the Print view​

Answers

Answer:

Print Layout view is the one most closely related to what your document will look like when you actually print it. (In some versions of Word this view may be called Page Layout view.) ... This is the viewing mode you should use if you want to always see what your document will look like.

Explanation:

I hope this helps and pls mark me brainliest :)

Which Backstage view feature helps you to specifically remove customized information from a document? Protect Document Feedback Properties Manage Document

Answers

Explanation:

Properties. 100% correct. goodluck.

Answer:

properties on edg.

Explanation:

Write a Java program that takes as input a paragraph as a String and identifies if any of the words in the paragraph is a $1.00 word. The value of each word is calculated by adding up the value of each one of its characters. Each letter in the alphabet is worth its position in pennies i.e. a

Answers

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Enter paragraph: ");

 String para = input.nextLine();

 String[] para_words = para.split("\\s+");

 for (int i = 0; i < para_words.length; i++) {

     para_words[i] = para_words[i].replaceAll("[^\\w]", "");

     char[] eachword  = para_words[i].toCharArray();

     int penny = 0;

     for(char c : eachword){

         int value = (int)c;

         if(value<=122 && value>=97){   penny+=value-96;     }

         else if(value<=90 & value>=65){  penny+=value-64;  }

     }

     if(penny == 100){

         System.out.println(para_words[i]);

     }

       penny = 0;

}

}

}

Explanation:

Due to the length of the explanation, I've added the explanation as an attachment

Pls help I don’t know the answers

Answers

Answer:

1. DLL Files.

2. System software repair.

3. Software configuration.

4. Human-computer interaction.

5. A graphical user interface (GUI).

Explanation:

1. DLL Files can become lost or damaged on a computer and prevent it from working correctly. These are important registry files used by various system softwares to perform specific tasks.

2. System software repair is a type of software you can run to help fix computer problems. Some examples are disk defragmenter, regedit, etc.

3. Software configuration means the process of setting up an application and selecting specific options. This is usually done in the settings section of a software application or program.

4. Human-computer interaction is the name of the discipline concerned with the design of optimal user interfaces.

5. A graphical user interface (GUI) is what users make use of to interact with graphical icons and other visual elements in order to accomplish tasks.

(Python) Write an expression that prints 'You must be rich!' if the variables young and famous are both True. Sample output with inputs: 'True' 'True' You must be rich!

Answers

Answer:

young = True

famous = True

if young == True and famous == True:

   print("You must be rich!")

Explanation:

Given the number of every players of two cricket team to find the winner team and find total half-century,in C program

Answers

Answer:

podrías especificarla mas por favor

4. Select the correct answer.
Which file format combines different layers of information (text, images, tables, and so on) into one layer in the file?
A.
GIF
B.
PDF
C.
BMP
D.
TIFF
E.
PNG

Answers

Answer: B.  PDF

Explanation:

Portable Document Format (PDF) is such an important document that it is considered the international standard for information and document exchange. It is used for letters, resumes and even electronic contracts.

PDF was developed by Adobe to make it independent of the device or application it is being viewed on and combines layers of information into one layer thereby making it a flat document.

Leslie works in an SDLC team. When Leslie edits a file, it gets saved as an altered version. Later all the altered versions are combined to form the
final file. Which type of version control process does Leslie's company use?
OA.
file merging
ОВ.
file locking
Ос.
file subversion
OD.
file conversion
O E.
file diversion

Answers

Answer:

file subversion

Explanation:

File subversion is compliant with the copy-modify-and merge model. Here, users make personal working copies which they can adjust concurrently. After the adjustments, the files are merged into a final copy by the version control system or someone.

This is similar to the version control process of Leslie's company. The team members all save their altered versions of the files which are then finally merged into one final file.

(True/False). Will this SQL statement create a table called vehicletype? CREATE TABLE vehicletype (carid PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

Answers

Answer:

True

Explanation:

This  SQL statement that is used to create a table called vehicletype "CREATE TABLE vehicletype (carid PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT) is a true statement.

What is the SQL statement?

An SQL is a term that connote for Structured Query Language. SQL is known to be a type of statement that is often used  to query and alter the relational databases such as SQL Server.

Conclusively, This  SQL statement that is used to create a table called vehicletype  "CREATE TABLE vehicletype (carid PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT) is a true statement becaue it is the right step to take when creating it.

Learn more about  SQL statement  from

https://brainly.com/question/27089762

20 pts The Domain Name System translates the URL into
A. client
B. an IP address
C. a website
D. a web browser

Answers

B AN IP ADDRESS hope this helps you

Answer:

adress

Explanation:

(a) List 5 keys we can type with our left hand fingers
(b) List 5 keys we can type with our right hand fingers​

Answers

Answer:

A) a,s,d,f, and either g or caps lock

B) l,k,j,h, and, ;

Explanation:

The dealer's cost of a car is 85% of the listed price. The dealer would accept any offer that is at least $500 over the dealer's cost. Design an algorithm that prompts the user to input the list price of the car and print the least amount that the dealer would accept for the car.

Answers

Answer:

Explanation:

The following code is writen in Python. It is a function called minPrice. It asks the user to input the list price of the vehicle and then multiplies that by 0.85 in order to get the dealer's cost. Then it adds 500 to that price and returns it to the user as the minimum price that the dealer would accept for the car.

def minPrice():

   list_price = input("Please enter the list price of the car: ")

   dealers_cost = int(list_price) * 0.85

   min_accepted_price = dealers_cost + 500

   print(min_accepted_price)

16. Select the correct answer.
Which printer translates commands from a computer to draw lines on paper using several automated pens?
A.
dye-sublimation printer
B.
plotter
C.
laser printer
D.
inkjet printer
E.
photo printe

Answers

Answer: Plotter-- B

Explanation:

A Plotter is  sophisticated  printer that get commands from a computer and interprets them to draw high quality lines or vector  graphics on paper  rather than dots using one or several automated pens. This makes them useful in the area of  CAD , architecture drawings and engineering designs. The types of plotters we have include Drum Plotters, Flat Bed Plotters and Ink Jet Plotters.

The correct option is B. Plotter.

The following information should be considered:

A Plotter is sophisticated printer that received commands from a computer and interprets them to draw high quality lines or vector  graphics on paper instead than dots using one or several automated pens. This makes them useful in the area of CAD , architecture drawings and engineering designs. The types of plotters include Drum Plotters, Flat Bed Plotters and Ink Jet Plotters.

Learn more: brainly.com/question/17429689

Four reasons why computers are powerful

Answers

Answer:

You could search up almost anything you want

they have a lot of storage

you can find good information

they help you with a lot of things

Explanation:

also how they can process information in seconds

Draw a flowchart diagram for a program that display a person's name x times​

Answers

Answer:

See attachment for flowchart

Explanation:

The flowchart is as follows:

Step 1: Start

This signals the beginning of the flowchart

Step 2: Input name, x

This gets input for name and x from the user

Step 3: count = 0

This initializes count to 0

Step 4: Print name

This prints the person's name

Step 5: count = count + 1

This increments the number of times the name has been printed

Step 6: count = x?

This checks if the number of times the name has been printed is x times

If yes, step 7 is executed.

If no, step 4 is executed

Step 7: Stop

This signals the end of the flowchart

What is an embedded computer? explanation

Answers

Answer: embedded computer

Explanation: An embedded computer is a microprocessor-based system, specially designed to perform a specific function and belong to a larger system. It comes with a combination of hardware and software to achieve a unique task and withstand different conditions.

Answer:

An embedded computer is a computer that has been built to solve only a very few specific questions and is not easily changed.it has a processor, software, input and output.examples are: calculator, digital camera, elevator, copiers, printers.

True or False
3.The title tag defines a title for the page on the browser's Title bar.​

Answers

Answer:

it would be false because of the word tag you can title a browser bar tag

Explanation:

cause it would be improper

For which of the following tasks would a for-each loop be appropriate?
A. Reversing the order of the elements in an array.
B. Printing all the elements at even indices of an array.
C. Printing every element in an array.
D. Determining how many elements in an array of doubles are positive.
E. Determining whether an array of Strings is arranged in alphabetical order.
F. Printing every even number in an array of ints.

Answers

Answer:

The answer is "Option B, C,  and F".

Explanation:

In the For-each loop, it is used for traversing items in a sequence is the control flow expression. It typically required a loop becomes referred to it as an enhanced loop for iterating its array as well as the collection elements. This loop is a version shortcut that skips the need for the hasNext() method to get iterator and the loop and over an iterator, and the incorrect choice can be determined as follows:

In choice A, it is wrong because it can't reverse the array element.In choice D, it is wrong because it can't determine the array of positive.In choice E, it is wrong because it can't determine an array of the sting in alphabetical order.

Is this right ? Please helppppp 0111111110101011010111000010101011101010110010110101010110101110
How many nibbles are in the bit string? 5 nibbles
I
How many Bytes are in the bit string? 10 bytes
What is the bit size name for this bit string? 15/

Answers

Answer: 4054

Explanation:

i LEARND IT

Answer:

0111111110101011010111000010101011101010110010110101010110101110

How many nibbles are in the bit string? 16 nibbles

How many Bytes are in the bit string? 8 bytes

What is the bit size name for this bit string? 64

Write a method named countInRange that accepts three parameters: an ArrayList of integers, a minimum and maximum integer, and returns the number of elements in the list within that range inclusive. For example, if the list v contains {28, 1, 17, 4, 41, 9, 59, 8, 31, 30, 25}, the call of countInRange(v, 10, 30) should return 4. If the list is empty, return 0. Do not modify the list that is passed in.

Answers

Answer:

In Java:

The method is as follows:

public static int countInRange (ArrayList<Integer> MyList, int min, int max) {  

       int count = 0;

       for (int i = 0; i < MyList.size(); i++)  {

           if(MyList.get(i)>=min && MyList.get(i)<=max){

               count++;

           }  

       }

       return count;

 }

Explanation:

This defines the method

public static int countInRange (ArrayList<Integer> MyList, int min, int max) {

This declares and initializes count to 0  

       int count = 0;

This iterates through the ArrayList

       for (int i = 0; i < MyList.size(); i++)  {

This checks if current ArrayList element is between min and max (inclusive)

           if(MyList.get(i)>=min && MyList.get(i)<=max){

If yes, increase count by 1

               count++;

           }  

       }

This returns count

       return count;

 }

To call the method from main, use:

countInRange(v,m,n)

Where v is the name of the ArrayList, m and n are the min and max respectively.

Work-based learning can be defined as educational experiences that focus on

Answers

Answer:

Work Based Learning is an educational approach or instructional methodology that uses the workplace or real work to provide students with the knowledge and skills that will help them connect school experiences to real-life work activities and future career opportunities.

Explanation:

Work Based Learning is an educational approach or instructional methodology that uses the workplace or real work to provide students with the knowledge and skills that will help them connect school experiences to real-life work activities and future career opportunities.

What is Work based learning?

The broad term "work-based learning" (WBL) is used to describe activities that involve employers and schools working together to provide students with structured learning experiences.

By giving students the chance to apply the knowledge and skills they have learned in the classroom to actual circumstances, a good WBL program can increase the relevance of school-based learning.

Both the workplace and the school support work-based learning. While work site learning takes place outside of school in a company or other community group, school-based learning concentrates on academic and career preparation as part of the classroom curriculum.

Therefore, Work Based Learning is an educational approach or instructional methodology that uses the workplace or real work to provide students with the knowledge and skills that will help them connect school experiences to real-life work activities and future career opportunities.

To learn more about Work based learning, refer to the link:

https://brainly.com/question/13597551

#SPJ2

This is a Java programWrite a method with the following header to format the integer with the specified width. public String format(int number, int width) The method returns a string for the number with one or more prefix 0s. The size of the string is the width within the range 1 to 10000inclusive. For example, format(34, 4) returns 0034 and format(34,5) returns 00034. If the number is longer than the width, the method returns the string representation for the number. For example, format(34, 1) returns 34. Assume that, the size of the string is the width within the range 1 to 10000 inclusive and the number is an integer -2147483648 to 2147483648 inclusive.Input 34 4Output 0034You must use this particular Driver classclass DriverMain{public static void main(String args[]){Scanner input = new Scanner(System.in);int num = Integer.parseInt(input.nextLine().trim());int width = Integer.parseInt(input.nextLine().trim());GW6_P5 gw6P5 = new GW6_P5();System.out.print(gw6P5.format(num,width));}

Answers

Answer:

Following are the code to this question:

import java.util.*;//import package  

public class DriverMain//defining a class DriverMain

{

public static void main(String args[])//main method

{

int num,width;

Scanner input = new Scanner(System.in);//creating Scanner class fore user input

num = Integer.parseInt(input.nextLine().trim());//input value

width = Integer.parseInt(input.nextLine().trim());//input value

GW6_P5 gw6P5 = new GW6_P5();//creating base class object

System.out.print(gw6P5.format(num,width));//print method that calls base class format method

}

}

class GW6_P5 //defining base class GW6_P5

{

String format(int number, int width)//defining method format that takes two integer variable in its parameter  

{

String s = ""+number;//defining s String variable that holdes integer value

int digitCount = 0;//defining integer variable

while(number!=0) //defining while loop to check value is not equal to 0

{

digitCount++;//incrementing the integer variable value

number/=10;//holding quotient value

}

if(width>digitCount)//defining if block that checks width value greather then digitCount value  

{

for(int i=0;i<width-digitCount;i++)//defining for loop to add 0 in String variable  

{

s = "0"+s;//add value

}

}

return s;//return String value

}

}

Output:

34

5

00034

Explanation:

In the given code, a class "DriverMain" is defined, and inside the class main method is defined that defines two integer variable "num and width", that uses the scanner class to input the value, and in the next step the "GW6_P5" class object is created that calls the format method and print its values.

In the class "GW6_P5", the format method is defined, that declared the string and integer variables, in the while loop it checks number value not equal to 0, and increments the number values, and in the for loop it adds the 0 in string value and return its value.

Four reasons why computers are powerful

Answers

Answer:

Computers are powerful tools because they can process information with incredible speed, accuracy and dependability. They can efficiently perform input, process, output and storage operations, and they can store massive amounts of data. ... Midrange servers are bigger and more powerful than workstation computers.

Other Questions
answer options2783 plllllz its 100 and i give brain list Explain the similarities and differences between putting a beaker of ethanoic acid in the refrigerator and mixing it with sodium carbonate What is the distance of CDgiven that C (5,-2) and D (-3,8) Leave your answer as a square root. what were the Middle Colonies like? Choose all items that represent types of services provided by healthcare professionals.direct patient carelegal advicefollow-up carereferral to local resourcespatient educationpreventative care Name 2 difference between rosa parks and claudette colvin (pls helppp) The demand for loanable funds depends on future income.a. Trueb. False The physician has ordered acyclovir 200 mg tid. On hand you have 200 mg capsules. How many capsules will be given per day? Which of the following BEST describes a conflict of interest? O A. Two companies competing for the business of the same customer B. Parties engaging in an activity that does not equally benefit all parties C. An employee engaging in an activity that may benefit that individual to the detrimen O D. People on different sides of an issue agreeing to disagree O E. A company engaging in practices that conflict with government regulations Click to select your answer. suppose you create a graph of the cost function, c=20n + 500 of a new bookstore, and you also graph the revenue function, r=25n, where n is the number of books sold. On your graph, would the point n=150 in the loss section, the profit section, or the break-even section. Explain how the Renaissance was a rebirth please help im timed how would you solve 17=w/4? solve the system of equations 6x+3y=12 and 5x+y=7 I know the answer but I just wanna give points first correct answer will get brainliest whats the smallest part of matter? I don't understand... Please help Kari estimated the quotient of Negative 12 and one-fifth divided by 4 and two-fifths to be 8. Which best describes her error? What is the base of the expression 1112?o 3O 11O 12o 21 The Louisiana Purchase gave the United States direct access to; British Columbia.; the Northwest Passage.; the Appalachian Mountains.; the Gulf of Mexico. Discuss changes to demand for fuel resources such as coal, petroleum, and natural gas as the demand for energy increases around the world in the modern global economy. Then, discuss the distribution of supply for these resources.