Answer:
Here is the code.
Explanation:
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
class Employee
{
private:
string employeeName;
int employeeNumber;
int hireDate;
public:
void setemployeeName(string employeeName);
void setemployeeNumber(int);
void sethireDate(int);
string getemployeeName() const;
int getemployeeNumber() const;
int gethireDate() const;
Employee();
};
void Employee::setemployeeName(string employeeName)
{
employeeName = employeeName;
}
void Employee::setemployeeNumber(int b)
{
employeeNumber = b;
}
void Employee::sethireDate(int d)
{
hireDate = d;
}
string Employee::getemployeeName() const
{
return employeeName;
}
int Employee::getemployeeNumber() const
{
return employeeNumber;
}
int Employee::gethireDate() const
{
return hireDate;
}
Employee::Employee()
{
cout << "Please answer some questions about your employees, ";
}
class ProductionWorker :public Employee
{
private:
int Shift;
double hourlyPay;
public:
void setShift(int);
void sethourlyPay(double);
int getShift() const;
double gethourlyPay() const;
ProductionWorker();
};
void ProductionWorker::setShift(int s)
{
Shift = s;
}
void ProductionWorker::sethourlyPay(double p)
{
hourlyPay = p;
}
int ProductionWorker::getShift() const
{
return Shift;
}
double ProductionWorker::gethourlyPay() const
{
return hourlyPay;
}
ProductionWorker::ProductionWorker()
{
cout << "Your responses will be displayed after all data has been received. "<<endl;
}
int main()
{
ProductionWorker info;
string name;
int num;
int date;
int shift;
double pay;
cout << "Please enter employee name: ";
cin >> name;
cout << "Please enter employee number: ";
cin >> num;
cout << "Please enter employee hire date using the format \n";
cout << "2 digit month, 2 digit day, 4 digit year as one number: \n";
cout << "(Example August 12 1981 = 08121981)";
cin >> date;
cout << "Which shift does the employee work: \n";
cout << "Enter 1, 2, or 3";
cin >> shift;
cout << "Please enter the employee's rate of pay: ";
cin >> pay;
info.setemployeeName(name);
info.setemployeeNumber(num);
info.sethireDate(date);
info.setShift(shift);
info.sethourlyPay(pay);
cout << "The data you entered for this employee is as follows: \n";
cout << "Name: " << info.getemployeeName() << endl;
cout << "Number: " << info.getemployeeNumber() << endl;
cout << "Hire Date: " << info.gethireDate() << endl;
cout << "Shift: " << info.getShift() << endl;
cout << setprecision(2) << fixed;
cout << "Pay Rate: " << info.gethourlyPay() << endl;
system("pause");
return 0;
}
Use ordinary pipes to implement an inter-process communication scheme for message passing between processes. Assume that there are two directories, d1 and d2, and there are different files in each one of them. Also, each file contains a short-length string of characters. You have to use a parent process that forks two children processes, and have each child process check one of the directories.
Answer:
Yup
Explanation:
What is the output? answer = "Hi mom print(answer.lower()) I
Answer: hi mom
Explanation: got it right on edgen
Develop an algorithm and write a C++ program that finds the number of occurrences of a specified character in the string; make sure you take CString as input and return number of occurrences using call by reference. For example, Write a test program that reads a string and a character and displays the number of occurrences of the character in the string. Here is a sample run of the program:______.
Answer:
The algorithm is as follows:
1. Input sentence
2. Input character
3. Length = len(sentence)
4. count = 0
5. For i = 0 to Length-1
5.1 If sentence[i] == character
5.1.1 count++
6. Print count
7. Stop
The program in C++ is as follows:
#include <iostream>
#include <string.h>
using namespace std;
int main(){
char str[100]; char chr;
cin.getline(str, 100);
cin>>chr;
int count = 0;
for (int i=0;i<strlen(str);i++){
if (str[i] == chr){
count++;} }
cout << count;
return 0;}
Explanation:
I will provide explanation for the c++ program. The explanation can also be extended to the algorithm
This declares the string and the character
char str[100]; char chr;
This gets input for the string variable
cin.getline(str, 100);
This gets input for the character variable
cin>>chr;
This initializes count to 0
int count = 0;
This iterates through the characters of the string
for (int i=0;i<strlen(str);i++){
If the current character equals the search character, count is incremented by 1
if (str[i] == chr){ count++;} }
This prints the count
cout << count;
Given the following tree, use the hill climbing procedure to climb up the tree. Use your suggested solutions to problems if encountered. K is the goal state and numbers written on each node is the estimate of remaining distance to the goal.
Write 'T' for true and 'F' for false statements.
1. The CPU is a piece of external hardware.
2. Keyboards can be connected to a computer using USB port.
3. Monitors are connected via the PS/2 port.
4. A computer can function without a CD drive.
5. Printer is an input device.
6. The read write data in magnetic disks.
7. Pen drives are connected to a computer via the USB interface.
NO LINKS
A hacker gains access to a web server and reads the credit card numbers stored on that server. Which security principle is violated? Group of answer choices Authenticity Integrity Availability Confidentiality PreviousNext
Answer:
Confidentiality
Explanation:
Cyber security can be defined as a preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.
In Cybersecurity, there are certain security standards, frameworks, antivirus utility, and best practices that must be adopted to ensure there's a formidable wall to prevent data corruption by malwares or viruses, protect data and any unauthorized access or usage of the system network.
In this scenario, a hacker gains access to a web server and reads the credit card numbers stored on that server. Thus, the security principle which is violated is confidentiality.
Confidentiality refers to the act of sharing an information that is expected to be kept secret, especially between the parties involved. Thus, a confidential information is a secret information that mustn't be shared with the general public.
This ultimately implies that, confidentiality requires that access to collected data be limited only to authorized staffs or persons.
Write a function addingAllTheWeirdStuff which adds the sum of all the odd numbers in array2 to each element under 10 in array1. Similarly, addingAllTheWeirdStuff should also add the sum of all the even numbers in array2 to those elements over 10 in array1.
Answer:
The function is as follows:
def addingAllTheWeirdStuff(array1,array2):
sumOdd = 0
for i in array2:
if i % 2 == 1:
sumOdd+=i
for i in array1:
if i < 10:
sumOdd+=i
print("Sum:",sumOdd)
sumEven = 0
for i in array1:
if i % 2 == 0:
sumEven+=i
for i in array2:
if i > 10:
sumEven+=i
print("Sum:",sumEven)
Explanation:
This declares the function
def addingAllTheWeirdStuff(array1,array2):
This initializes the sum of odd numbers in array 2 to 0
sumOdd = 0
This iterates through array 2
for i in array2:
This adds up all odd numbers in it
if i % 2 == 1:
sumOdd+=i
This iterates through array 1
for i in array1:
This adds up all elements less than 10 to sumOdd
if i < 10:
sumOdd+=i
This prints the calculated sum
print("Sum:",sumOdd)
This initializes the sum of even numbers in array 1 to 0
sumEven = 0
This iterates through array 1
for i in array1:
This adds up all even numbers in it
if i % 2 == 0:
sumEven+=i
This iterates through array 2
for i in array2:
This adds up all elements greater than 10 to sumEven
if i > 10:
sumEven+=i
This prints the calculated sum
print("Sum:",sumEven)
16. A 6-cylinder engine has a bore of 4 inches and a stroke of 3.5 inches. What's the total piston displacement?
A. 260
B. 263.76
C. 253.76
D. 250
Answer:
b i just guessed
Explanation:
Janice is preparing a recipe that calls for 3/4 cup of oil per serving if Janice needs to prepare for 2 / 2 3 servings how many cups of oil would she neex
Answer:
Three cups would be needed.
Explanation:
2 2/3 × 3/4 = 8/2 × 3/4 = 24/8 = 3
We will find an video named????
Help us and select once name.
Complete: B__in___t
How can we use APC to help with dynamic tracks?
Answer:
We can use APC to help with dynamic tracks by :-
by finding dynamic tracks. by checking if the dynamic tracks are fully completed.
IT specialists must display technical expertise and collaborative proficiency in the workplace. Select the IT specialist who demonstrates a soft skill.
a. Terri uses her Java programming skills to write a key part of the company’s new software.
b. Joyce recruits users to test new software by explaining to them how it will benefit the organization.
c. Chandler evaluates the results of recent user tests of his company's new software.
d. Keith applies a filter to the company’s network that prevents users from accessing social media while they are working.
Answer:
b. Joyce recruits users to test new software by explaining to them how it will benefit the organization.
Explanation:
Skills can be classified as hard or soft. Hard skills include skills such as technical skills that are acquired through technical knowledge and training.
Soft skills on the other hand are skills exhibited as a result of personality traits, character and behaviours such as time management, leadership, communication and organizational skills.
Some hard skills include;
i. Ability to design banners and posters
ii. Proficiency in using programming languages such as Java to build software applications
iii. Evaluating the result of a test or research.
Some soft skills include;
i. Making public speeches that captivate the audience.
ii. Ability to recruit and test capabilities in others.
iii. Leading a team
So, Joyce recruiting users to test new software by explaining to them how it will benefit the organization is a form of soft skill since it consists, at minimum, of leadership and communication skills
Mice can be connected to a computer using the _________ or ________ port.
Write a recursive method that receives a string as a parameter and recursively capitalizes each character in the string (change a small cap to a large cap, e.g. a to A, b to B, etc) as following: capitalize the first letter from the string, then calls the function recursively for the remainder of the string and in the end, build the capitalized string. For example, for "java", will capitalize the first letter to "J"(base case), calls the method recursively for the reminder of the string "ava" (reduction), and after recursion/reduction is over it and returns "AVA" will build a new string from "J" and "AVA" and return "JAVA" to the calling method.
Write this algorithms in java source code plz.
Answer:
String words[]=str.split("\\s");
String capitalizeWord="";
for(String w:words){
String first=w.substring(0,1);
String afterfirst=w.substring(1);
capitalizeWord+=first.toUpperCase()+afterfirst+" ";
}
return capitalizeWord.trim();
Explanation:
Define the word you are trying to capitalize and split it into an array.
String words[]=str.split("\\s");
Create a string for the capital output to be created as
String capitalizeWord="";
Capitalize the word using the "first.toUpperCase()" and "afterfirst" functions
for(String w:words){
String first=w.substring(0,1);
String afterfirst=w.substring(1);
capitalizeWord+=first.toUpperCase()+afterfirst+" ";
}
Unchecked exceptions require you surround the code that might throw such an exception with a try block or you must use a throws statement at the end of the method signature. Failure to do one of these two things will result in a compile error.
a. True
b. False
Answer:
b. False
Explanation:
False, unchecked exceptions do not cause compilation errors and do not require try/catch blocks or throws statements. However, although they are not required it is good programming to include them in order to handle any exceptions that may arise. If you do not include a proper way to handle such an exception the program will still run but may run into an exception during runtime. If this occurs then the entire program will crash because it does not know how to handle the exception since you did not provide instructions for such a scenario.
In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
locations. You will create instructions to move the colored boxes in grid one to their final location in grid two. Use the
example to help you. The algorithm that you will write should be in everyday language
(no pseudocode or programming language). Write your instructions at the bottom of the
page.
Example: 1. Move
the orange box 2
spaces to the right.
2. Move the green
box one space
down. 3. Move the
green box two
spaces to the left.
Write your instructions. Review the rubric to check your final work.
Rules: All 6 colors (red, green, yellow, pink, blue, purple) must be move to their new location on the grid. Block spaces are
barriers. You cannot move through them or on them – you must move around them
Answer:
Explanation:
Pink: Down 5 then left 2.
Yellow: Left 3 and down 2.
Green: Right 7, down 4 and left 1.
Purple: Up 6 and left 9.
Red: Left 7, down 5 and left 1.
You can do the last one, blue :)
Answer:
Explanation:
u=up, d=down, r=right, l=left
yellow: l3d2
pink: d5l2
green: r7d4l1
purple: u6l9
red: l7d5l1
blue: r2u7l5
HEYYY! you're probably a really fast typer can you please type this for me! i tried copying and pasting it but it wouldn't let me!!! sooo can you please be a dear and kindly type it for me ^^
what i want you to type is directly in the image so please type exactly that
i dunno what subject this would be under so i'll just put it in any
Answer:
here you go. wish you a great day tomorrow.
and in fact,computer science is somewhat the right category
Abstract art may be - and may seem like - almost anything. This because, unlike the painter or artist who can consider how best they can convey their mind using colour or sculptural materials and techniques. The conceptual artist uses whatever materials and whatever form is most suited to putting their mind across - that would be anything from the presentation to a written statement. Although there is no one kind or structure employed by abstract artists, from the late 1960s specific tendencies emerged.
The _________ attack exploits the common use of a modular exponentiation algorithm in RSA encryption and decryption, but can be adapted to work with any implementation that does not run in fixed time.
A. mathematical.
B. timing.
C. chosen ciphertext.
D. brute-force.
Answer:
chosen ciphertext
Explanation:
Chosen ciphertext attack is a scenario in which the attacker has the ability to choose ciphertexts C i and to view their corresponding decryptions – plaintexts P i . It is essentially the same scenario as a chosen plaintext attack but applied to a decryption function, instead of the encryption function.
Cyber attack usually associated with obtaining decryption keys that do not run in fixed time is called the chosen ciphertext attack.
Theae kind of attack is usually performed through gathering of decryption codes or key which are associated to certain cipher texts The attacker would then use the gathered patterns and information to obtain the decryption key to the selected or chosen ciphertext.Hence, chosen ciphertext attempts the use of modular exponentiation.
Learn more : https://brainly.com/question/14826269
this can provide illusion of fast movement it is often used in videos to censor information for security or density
Answer:
Blurring can provide the optical illusion of a fast movement. It is often used in videos to hide sensitive or age-inappropriate information, the protection of identities (hence security) or just to provide decency.
Explanation:
Mostly used during animated videos where unlike (real videos) the blur does not occur naturally, the blur is used to make speed believable. Speed invigorates, and highlights intensity. Blurring still images can help to make more realistics motions of speed. An example where lots of blurring is used as prostproduction effects is in Flash.
Cheers
What two benefits are a result of configuring a wireless mesh network? Check all that apply.
1. Performance
2. Range
3. WiFi protected setup
4. Ad-hoc configuration
Answer:
1)PERFORMANCE
2)RANGE
Explanation:
A mesh network can be regarded as local network topology whereby infrastructure nodes connect dynamically and directly, with other different nodes ,cooperate with one another so that data can be efficiently route from/to clients. It could be a Wireless mesh network or wired one.
Wireless mesh network, utilize
only one node which is physically wired to a network connection such as DSL internet modem. Then the one wired node will now be responsible for sharing of its internet connection in wireless firm with all other nodes arround the vicinity. Then the nodes will now share the connection in wireless firm to nodes which are closest to them, and with this wireless connection wide range of area can be convered which is one advantage of wireless mesh network, other one is performance, wireless has greater performance than wired one.
Some of the benefits derived from configuring a wireless mesh network is
1)PERFORMANCE
2)RANGE
Based on the information given, the correct options are performance and range.
It should be noted that a mesh network can be regarded as the local network topology whereby infrastructure nodes connect directly, with other different nodes ,cooperate with one another so that data can be efficiently route from/to clients.
The advantage of configuring a wireless mesh network is that it enhances performance and range.
Learn more about network on:
https://brainly.com/question/1167985
Write a function called rotateRight that takes a String as its first argument and a positive int as its second argument and rotates the String right by the given number of characters. Any characters that get moved off the right side of the string should wrap around to the left.
Answer:
The function in Python is as follows:
def rotateRight(strng, d):
lent = len(strng)
retString = strng[lent - d : ] + strng[0 : lent - d]
return retString
Explanation:
This defines the function
def rotateRight(strng, d):
This calculates the length of the string
lent = len(strng)
This calculates the return string
retString = strng[lent - d : ] + strng[0 : lent - d]
This returns the return string
return retString
Addition:
The return string is calculated as thus:
This string is split from the index passed to the function to the last element of the string, i.e. from dth to last.
The split string is then concatenated to the beginning of the remaining string
Given two regular expressions r1 and r2, construct a decision procedure to determine whether the language of r1 is contained in the language r2; that is, the language of r1 is a subset of the language of r2.
Answer:
Test if L(M1-2) is empty.
Construct FA M2-1 from M1 and M2 which recognizes the language L(>M2) - L(>M1).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M2-1) is empty.
Answer yes if and only if both answers were yes.
Explanation:
An algorithm must be guaranteed to halt after a finite number of steps.
Each step of the algorithm must be well specified (deterministic rather than non-deterministic).
Three basic problems:
Given an FA M and an input x, does M accept x?
Is x in L(M)
Given an FA M, is there a string that it accepts?
Is L(M) the empty set?
Given an FA M, is L(M) finite?
Algorithm for determining if M accepts x.
Simply execute M on x.
Output yes if we end up at an accepting state.
This algorithm clearly halts after a finite number of steps, and it is well specified.
This algorithm is also clearly correct.
Testing if L(M) is empty.
Incorrect "Algorithm"
Simulate M on all strings x.
Output yes if and only if all strings are rejected.
The "algorithm" is well specified, and it is also clearly correct.
However, this is not an algorithm because there are an infinite number of strings to simulate M on, and thus it is not guaranteed to halt in a finite amount of time.
COMMENT: Note we use the algorithm for the first problem as a subroutine; you must think in this fashion to solve the problems we will ask.
Correct Algorithm
Simulate M on all strings of length between 0 and n-1 where M has n states.
Output no if and only if all strings are rejected.
Otherwise output yes.
This algorithm clearly halts after a finite number of steps, and it is well specified.
The correctness of the algorithm follows from the fact that if M accepts any strings, it must accept one of length at most n-1.
Suppose this is not true; that is, L(M) is not empty but the shortest string accepted by M has a length of at least n.
Let x be the shortest string accepted by M where |x| > n-1.
Using the Pumping Lemma, we know that there must be a "loop" in x which can be pumped 0 times to create a shorter string in L.
This is a contradiction and the result follows.
COMMENT: There are more efficient algorithms, but we won't get into that.
Testing if L(M) is finite
Incorrect "Algorithm"
Simulate M on all strings x.
Output yes if and only if there are a finite number of yes answers.
This "algorithm" is well specified and correct.
However, this is not an algorithm because there are an infinite number of strings to simulate M on, and thus it is not guaranteed to halt in a finite amount of time.
COMMENT: Note we again use the algorithm for the first problem as a subroutine.
Correct Algorithm
Simulate M on all strings of length between n and 2n-1 where M has n states.
Output yes if and only if no string is accepted.
Otherwise output no.
This algorithm clearly halts after a finite number of steps, and it is well specified.
The correctness of the algorithm follows from the fact that if M accepts an infinite number of strings, it must accept one of length between n and 2n-1.
This builds on the idea that if M accepts an infinite number of strings, there must be a "loop" that can be pumped.
This loop must have length at most n.
When we pump it 0 times, we have a string of length less than n.
When we pump it once, we increase the length of the string by at most n so we cannot exceed 2n-1. The problem is we might not exceed n-1 yet.
The key is we can keep pumping it and at some point, its length must exceed n-1, and in the step it does, it cannot jump past 2n-1 since the size of the loop is at most n.
This proof is not totally correct, but it captures the key idea.
COMMENT: There again are more efficient algorithms, but we won't get into that.
Other problems we can solve using these basic algorithms (and other algorithms we've seen earlier this chapter) as subroutines.
COMMENT: many of these algorithms depend on your understanding of basic set operations such as set complement, set difference, set union, etc.
Given a regular expression r, is Lr finite?
Convert r to an equivalent FA M.
COMMENT: note we use the two algorithms for converting a regular expression to an NFA and then an NFA to an FA.
Test if L(M) is finite.
Output the answer to the above test.
Given two FAs M1 and M2, is L(M1) = L(M2)?
Construct FA M1-2 from M1 and M2 which recognizes the language L(>M1) - L(>M2).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M1-2) is empty.
Construct FA M2-1 from M1 and M2 which recognizes the language L(>M2) - L(>M1).
COMMENT: note we use the algorithm that is instrumental in proving that regular languages are closed with respect to the set difference operator.
Test if L(M2-1) is empty.
Answer yes if and only if both answers were yes.
What is a fruitful function? Explain with help of programming example?
plz
Write a Program that will print all the numbers divisible by 2 between 0 and 100
Answer:
//In java
for (int i = 0; i <= 100; i++)
{
if ( i % 2 == 0 )
{
System.out.println( i + " ");
}
}
what is the meaning of antimonographycationalis
Answer:
Although this word was made up in order to be a contender for the longest word in English, it can be broken down into smaller chunks in order to understand it.
Anti- means that you are against something; monopoly means the exclusive control over something; geographic is related to geography; and the remaining part has to do with nationalism.
So this word means something like 'a nationalistic feeling of being against geographic monopoly,' but you can see that it doesn't have much sense.
(answer copied from Kalahira just to save time)
Assume the variable sales references a float value. Write a statement that displays the value rounded to two decimal points.Assume the following statement has been executed:
number = 1234567.456
Write a Python statement that displays the value referenced by the number variable formatted as
1,234,567.5
Answer:
The statement is as follows:
print("{0:,.1f}".format(number))
Explanation:
Required
Statement to print 1234567.456 as 1,234,567.5
To do this, we make use of the format keyword, and we set the print format in the process.
To round up number to 1 decimal place, we use the following format:
"{0:,.1f}"
To include comma in the thousand place, we simply include a comma sign before the number of decimal place of the output; i.e. before 1
"{0:,.1f}"
So, the print statement is:
print("{0:,.1f}".format(number))
Suppose you are collecting money for something.
You need # 200 in all. You ask your parents, uncles
and aunts as well as grandparents. Different people
may give either ` 10, ` 20 or even ` 50. You will collect
till the total becomes 200. Write the algorithm.
Answer:
Step 1 : Start
Step 2 : Set target= 0
Step 3 : Use a While loop
Step 4 : input donation
Step 5 : Sum - - > target += donation
Step 6 :, check loop condition
Step 7 : End
Explanation:
Algorithm is a sequence of written instructions or steps which we want the computer to in other to solve a particular problem :
Counter is set at 0
Total amount is initially set to := 0
Using a while loop ;
While target amout is less than 200 ; user inputs the amout to donate and it is added to target amount. This loop continues until target amount is greater than 200. Then the loop terminates.
Design a function int maxDigit (int num) to find and return the greatest digit from the arguments value num.
Also write a function void result() by passing parameters to print the greatest digit.
please tell in java programming
Answer:
Below is the required JAVA Code:
Explanation:
public static int largestDigit(int n) {
if (n < 0) {
return largestDigit(-1 * n);
} else if (n == 0) {
return 0;
} else {
int digit = n % 10;
int maxDigit = largestDigit(n / 10);
if (digit > maxDigit)
maxDigit = digit;
return maxDigit;
}
}
\color{red}Method\;tested\;in\;a\;complete\;java\;program\;if\;you\;are\;interested.
public class LargestDigitRecursive {
public static int largestDigit(int n) {
if (n < 0) {
return largestDigit(-1 * n);
} else if (n == 0) {
return 0;
} else {
int digit = n % 10;
int maxDigit = largestDigit(n / 10);
if (digit > maxDigit)
maxDigit = digit;
return maxDigit;
}
}
public static void main(String[] args) {
System.out.println(largestDigit(14263203));
System.out.println(largestDigit(845));
System.out.println(largestDigit(52649));
System.out.println(largestDigit(3));
System.out.println(largestDigit(0));
System.out.println(largestDigit(-573026));
System.out.println(largestDigit(-2));
}
}
OUTPUT:
6
8
9
3
0
7
2
Write a short essay on the importance of information and communication technology (ICT) in the AFN industry. Add suitable examples to substantiate your answer.
Answer:
computer
Explanation:
is an ICT device that help and makes things or work easy
LAB: Winning team (classes)
Complete the Team class implementation. For the class method get_win_percentage(), the formula is:
team_wins / (team_wins + team_losses)
Note: Use floating-point division.
Ex: If the input is:
Ravens
13
3
where Ravens is the team's name, 13 is the number of team wins, and 3 is the number of team losses, the output is:
Congratulations, Team Ravens has a winning average!
If the input is Angels 80 82, the output is:
Team Angels has a losing average.
------------------------------------------------------------------------------------------------------------------------------------
We are given:
class Team:
def __init__(self):
self.team_name = 'none'
self.team_wins = 0
self.team_losses = 0
# TODO: Define get_win_percentage()
if __name__ == "__main__":
team = Team()
team_name = input()
team_wins = int(input())
team_losses = int(input())
team.set_team_name(team_name)
team.set_team_wins(team_wins)
team.set_team_losses(team_losses)
if team.get_win_percentage() >= 0.5:
print('Congratulations, Team', team.team_name,'has a winning average!')
else:
print('Team', team.team_name, 'has a losing average.')
Please help, in Python!
Answer:
The function is as follows:
def get_win_percentage(self):
return self.team_wins / (self.team_wins + self.team_losses)
Explanation:
This defines the function
def get_win_percentage(self):
This calculates the win percentage and returns it to main
return self.team_wins / (self.team_wins + self.team_losses)
See attachment for complete (and modified) program.
Answer: def get_win_percentage(self):
Explanation: got it right on edgen