Write a program that calculates the average of 4 temperatures. Function 1--write a function to ask a user for 4 temperatures and return them to main. Validate that none of them is negative. Also return a boolean indicating that the data is good or bad. Function 2--write a value-returning function to calculate the average and return it as a double if the data is good. Display an error message if any score was negative.
Answer:
Answered below
Explanation:
Answer written in Python programming language
temp_list = []
count = 0
sum = 0
n = 0
is_good = True
def temperatures(temp1, temp2, temp3, temp4){
temp_list = [temp1, temp2, temp3, temp4]
for i in temp_list:
if i < 0:
is_good = False
break
return is_good
}
def average ( ){
if is_good:
for i in temp_list:
sum += i
count++
average = sum / count
return average
}
What is the relationship between an object and class in an OOP program?
The object contains classes.
The object and class are the same thing.
The object is used to create a class.
The object in a program is called a class.
Answer:
D. The object in a program is called a class.
Explanation:
Java is a object oriented and class-based programming language. It was developed by Sun Microsystems on the 23rd of May, 1995. Java was designed by a software engineer called James Gosling and it is originally owned by Oracle.
In object-oriented programming (OOP) language, an object class represents the superclass of every other classes when using a programming language such as Java. The superclass is more or less like a general class in an inheritance hierarchy. Thus, a subclass can inherit the variables or methods of the superclass.
Basically, all instance variables that have been used or declared in any superclass would be present in its subclass object.
Hence, the relationship between an object and class in an OOP program is that the object in a program is called a class.
For example, if you declare a class named dog, the objects would include barking, color, size, breed, age, etc. because they are an instance of a class and as such would execute a method defined in the class.
describe a sub routine
Explanation:
A routine or subroutine, also referred to as a function procedure and sub program is code called and executed anywhere in a program. FOr example a routine may be used to save a file or display the time.
In the following code segment, assume that the ArrayList numList has been properly declared and initialized to contain the Integer values [1, 2, 2, 3]. The code segment is intended to insert the Integer value val in numList so that numList will remain in ascending order. The code segment does not work as intended in all cases.
int index = 0;
while (val > numList.get(index))
{
index++;
}
numList.add(index, val);
For which of the following values of val will the code segment not work as intended?
a. 0
b. 1
c. 2
d. 3
e. 4
Answer:
e. 4
Explanation:
The code segment will not work as intended if the value of the variable val is 4. This is because the while loop is comparing the value of the variable val to the value of each element within the numList. Since there is no element that is bigger than or equal to the number 4, this means that if the variable val is given the value of 4 it will become an infinite loop. This would cause the program to crash and not work as intended.
The program illustrates the use of while loops.
The code segment will not work as intended when the value of val is 4
LoopsLoops are used to perform repeated operations
The programFrom the program, the while loop is repeated under the following condition:
val > numList.get(index)
This means that:
The loop is repeated as long as val has a value greater than the index of numList (i.e. 3)
From the list of options, 4 is greater than 3.
Hence, the code segment will not work as intended when the value of val is 4
Read more about loops at:
https://brainly.com/question/19344465
Assume that you are working with spreadsheets, word processing documents, presentation slides, images, and sound files for a school project. You stored all your files in a folder named “untitled” on your laptop. Now, you cannot locate a particular document in this folder and you realize that you need to organize your files properly.
Write down the steps that you will take to organize your files.
Answer:
See explanation below.
Explanation:
File organization is very important especially when one is working with numerous files from different applications.
When you are working with spreadsheets, word processing documents, presentation slides, images and sound files, it is important to create folders and sub-folders to make locating your files a lot easier.
Make sure you have all your files saved with names that are relevant to your school project.Create a sub-folder to store all spreadsheets files, create a sub-folder to store all word processing files, create a sub-folder to store all presentation slides and create another folder to store images and sound files. You do this to make it easy for you to locate whichever file you want. You create the sub-folder by right clicking on your documents section and clicking on new folder. Type in the name of the folder and save.After creating sub-folders, create a general folder for all your folders by using the same method in step 3. Copy all your sub-folders into this major folder. You can name this folder the name of your school project.This way, you never have to look for any files for your school project.
Questions Presscomion
Answer:
i dont get what you are trying to ask
Explanation:
Rules used by a computer network
A network protocol
B hierchary protocal
C procedure
Answer:
The answer is B hierchary protocal
Answer:
its network protocol
Explanation:
I got it right
Write a java program named BMI.java(i)print out your name and your pantherID(ii) Ask user to type in his/her weight and height; if an illegal input (such as a letter) is typed by the user, give the user one more chance to input correctly.(iii)Create a method to compute the body mass index (BMI) accordingly. BMI
Answer:
Answered below
Explanation:
//Print name and ID
Scanner x = new Scanner(System.in);
System.out.print("Enter name");
String name = x.nextline();
Scanner y = new Scanner(System.in);
System.out.print("Enter ID");
int id = y.nextline();
System.out.println(name, id);
Scanner w = new Scanner(System.in);
System.out.print("enter weight");
double weight = w.nextline();
Scanner h = new Scanner(System.in);
System.out.print("enter height: ");
double height = h.nextline();
int i = 0;
while( I < 2){
if ( !isDigit(weight) && !isDigit(height){
Scanner w = new Scanner(System.in);
System.out.print("enter weight:);
weight = w.nextline();
Scanner h = new Scanner(System.in);
System.out.print("enter height");
height = h.nextline();
}else{
break;
double BMI = weight / ( height **2)
System.out.print(BMI)}
I++
}
what if an html code became cracked and formed a bug how can i repair that
Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for the year. Using the information entered by the user and selection statements, display how many days are in the month. Note: In the name of the file, LastName should be replaced with your last name and FirstName should be replaced with your first name. When you run your program, it should look similar to this:
Answer:
Explanation:
The following code is written in Java and uses Switch statements to connect the month to the correct number of days. It uses the year value to calculate the number of days only for February since it is the only month that actually changes. Finally, the number of days is printed to the screen.
import java.util.Scanner;
public class NumDaysPerezGabriel {
public static void main(String args[]) {
int totalDays = 0;
Scanner in = new Scanner(System.in);
System.out.println("Enter number for month (Ex: 01 for January or 02 for February): ");
int month = in.nextInt();
System.out.println("Enter 4 digit number for year: ");
int year = in.nextInt();
switch (month) {
case 1:
totalDays = 31;
break;
case 2:
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
totalDays = 29;
} else {
totalDays = 28;
}
break;
case 3:
totalDays = 31;
break;
case 4:
totalDays = 30;
break;
case 5:
totalDays = 31;
break;
case 6:
totalDays = 30;
break;
case 7:
totalDays = 31;
break;
case 8:
totalDays = 31;
break;
case 9:
totalDays = 30;
break;
case 10:
totalDays = 31;
break;
case 11:
totalDays = 30;
break;
case 12:
totalDays = 31;
}
System.out.println("There are a total of " + totalDays + " in that month for the year " + year);
}
}
What Game is better Vacation Simulator Or Beat Saber
Answer:
I love Beat Saber and Beat Saber is the best!!!!
Explanation:
Answer:
I would have to agree with the other person I think Beat Saber is better than Vacation Simulator
Explanation:
~Notify me if you have questions~
have a nice day and hope it helps!
^ω^
-- XxFTSxX
What is block chain?
Answer:
Block Chain is a system of recording information that makes it difficult or impossible to change, hack, or cheat the system.
A blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems on the blockchain.
Hope this helps.
x
Key Categories: more libraries and thousands of functions
Select one:
a. Power
b. Practicality
c. Possibility
d. Price
Key Categories: more libraries and thousands of functions is Practicality. Hence, option B is correct.
What is Practicality?the ability to perform something or put something into action: Bankers expressed dissatisfaction with the new rules' viability as workable answers to challenging issues. He believes that wind energy can be a useful renewable energy source. For the majority of residential residences, the equipment is too large to be useful. Although the shoes are attractive, they are not particularly useful. The book is a helpful manual for maintaining cars.
tailored or created for actual use; beneficial: useful guidelines. interested or skilled in practical application or work: a pragmatic politician with a record of enacting significant legislation.
The definition of practical thinking is "examining ways to adapt to your surroundings or change your environment to fit you" in order to achieve a goal. Practicality is a term that is used occasionally.
Thus, option B is correct.
For more information about Practicality, click here:
https://brainly.com/question/24313388
#SPJ5
Assume hosts A and B are each connected to a switch Svia 100-Mbps links. The propagation delay on each link is 25μs. The switch Sis a store-and-forward device and it requires a delay of 35μs to process a packet after is has received the last bit in the packet. Calculate the total time required to transmit 40,000 bits from Ato B in the following scenarios. (The total time is measured from the start of the transmission of the first bit at A, until the last bit is received at B. We always assume that links are bi-directional with the same transmission rate and propagation delay in each direction unless specifically instructed otherwise.)
Answer:
885 μs
Explanation:
Given that:
Switch via = 100 Mbps links
The propagation delay for each link = 25μs.
Retransmitting a received packet = 35μs
To determine:
The total time required to transmit 40,000 bits from A to B.
Considering the fact as a single packet:
Transmit Delay / link = size/bandwith
= 4×10⁴ bits / 100 × 10⁶ bits/sec
= 400 μs
The total transmission time = ( 2 × 400 + 2 × 25 + 35) μs
= (800 + 50 + 35) μs
= 885 μs
If an excel column will contain prices of smartphones, which number format should you uss
Answer:
You can use number formats to change the appearance of numbers, including dates and times, without changing the actual number. The number format does not affect the cell value that Excel uses to perform calculations. The actual value is displayed in the formula bar. Excel provides several built-in number formats.
Explanation:
Imagine that you are designing an application where you need to perform the operations Insert, DeleteMaximum, and Delete Minimum. For this application, the cost of inserting is not important, because itcan be done off-line prior to startup of the time-critical section, but the performance of the two deletionoperations are critical. Repeated deletions of either kind must work as fast as possible. Suggest a datastructure that can support this application, and justify your suggestion. What is the time complexity foreach of the three key operation
Answer:
A stack data structure should be used. The time complexity of the insert, delete minimum and maximum operation is O(1).
Explanation:
The stack data structure is an indexed structure that holds data in an easily retrievable way. Data is held in a first-in last-out method as elements in the structure are popped out from the end of the stack when retrieved sequentially.
The worst-case time complexity of getting the minimum and maximum elements in a stack and deleting it is O(1), this is also true for inserting elements in the stack data structure.
Energy Drink Consumption A soft drink company recently surveyed 16,500 of its customers and found that approximately 15 percent of those surveyed purchase one or more energy drinks per week. Of those customers who purchase energy drinks, approximately 58 percent of them prefer citrus-flavored energy drinks. Write a program that displays the following: The approximate number of customers in the survey who purchase one or more energy drinks per week The approximate number of customers in the survey who prefer citrus-flavored energy drinks.
Answer:
Follows are the code to this question:
#include <iostream>//header file
using namespace std;
int main()//defining a main method
{
int customer= 16508;//defining an integer variable
int E_drink, C_drink;//defining an integer variable
double buy_Energy_drink,buy_cold_drink;//defining a double variable
buy_Energy_drink= 0.15;//use double variable to assign value
buy_cold_drink= buy_Energy_drink *0.58;//use double variable to calculate value
E_drink = customer*buy_Energy_drink;//calculating value of E_drink
C_drink= customer*buy_cold_drink;//calculating value of E_drink
cout<<"\t\t\t -:Energy Drink Consumption:-"<<endl;//print message
cout<<"According to A soft drink company surveyed 16,500 of its customers."<<endl;//print message
cout<<E_drink <<" customer purchase one or more energy drinks per week."<<endl;//print message with value
cout<<C_drink <<" customer who prefer citrus-flavored energy drinks."<<endl;//print message with value
return 0;
}
Output:
Please find the attached file.
Explanation:
In this code, three integer variable "customer, E_drink, and C_drink" is defined, in which the first variable is used to hold a value, and the next two variables are used for calculating the value.
In the next step, two double variables "buy_Energy_drink, buy_cold_drink" is defined that calculate the given percentage value and passed into the integer variable to calculate the value and print the value with the given message.
Sophisticated modeling software is helping international researchers
Answer:
A. increase the pace of research in finding and producing vaccines.
Explanation:
These are the options for the question;
A. increase the pace of research in finding and producing vaccines.
B. analyze computer systems to gather potential legal evidence.
C. market new types of products to a wider audience.
D. create more intricate screenplays and movie scripts.
Modeling software can be regarded as computer program developed in order to build simulations as well as other models. modelling software is device by international researchers to make research about different vaccines and other drugs and stimulants to combat different diseases. It helps the researcher to devoid of details that are not necessary and to deal with any complexity so that solution can be developed. It should be noted that Sophisticated modeling software is helping international researchers to increase the pace of research in finding and producing vaccines.
most of the answers for this test is wrong.
importance of spread sheets
Answer:
Spreadsheets are an essential business and accounting tool. They can vary in complexity and can be used for various reasons, but their primary purpose is to organize and categorize data into a logical format. Once this data is entered into the spreadsheet, you can use it to help organize and grow your business.
Explanation:
Online privacy and data security are a growing concern. Cybercrime is rampant despite the various security measures taken.
-Mention five tools to safeguard users against cybercrime. How do these tools help decrease crime?
-Provide the details of how each of these tools work.
-Describe how these tools are helping to restrict cybercrime.
Answer:
The SANS Top 20 Critical Security Controls For Effective Cyber Defense
Explanation:
Password/PIN Policy
Developing a password and personal identification number policy helps ensure employees are creating their login or access credentials in a secure manner. Common guidance is to not use birthdays, names, or other information that is easily attainable.
Device Controls
Proper methods of access to computers, tablets, and smartphones should be established to control access to information. Methods can include access card readers, passwords, and PINs.
Devices should be locked when the user steps away. Access cards should be removed, and passwords and PINs should not be written down or stored where they might be accessed.
Assess whether employees should be allowed to bring and access their own devices in the workplace or during business hours. Personal devices have the potential to distract employees from their duties, as well as create accidental breaches of information security.
As you design policies for personal device use, take employee welfare into consideration. Families and loved ones need contact with employees if there is a situation at home that requires their attention. This may mean providing a way for families to get messages to their loved ones.
Procedures for reporting loss and damage of business-related devices should be developed. You may want to include investigation methods to determine fault and the extent of information loss.
Internet/Web Usage
Internet access in the workplace should be restricted to business needs only. Not only does personal web use tie up resources, but it also introduces the risks of viruses and can give hackers access to information.
Email should be conducted through business email servers and clients only unless your business is built around a model that doesn't allow for it.
Many scams and attempts to infiltrate businesses are initiated through email. Guidance for dealing with links, apparent phishing attempts, or emails from unknown sources is recommended.
Develop agreements with employees that will minimize the risk of workplace information exposure through social media or other personal networking sites, unless it is business-related.
Encryption and Physical Security
You may want to develop encryption procedures for your information. If your business has information such as client credit card numbers stored in a database, encrypting the files adds an extra measure of protection.
Key and key card control procedures such as key issue logs or separate keys for different areas can help control access to information storage areas.
If identification is needed, develop a method of issuing, logging, displaying, and periodically inspecting identification.
Establish a visitor procedure. Visitor check-in, access badges, and logs will keep unnecessary visitations in check.
Security Policy Reporting Requirements
Employees need to understand what they need to report, how they need to report it, and who to report it to. Clear instructions should be published. Training should be implemented into the policy and be conducted to ensure all employees understand reporting procedures.
Empower Your Team
One key to creating effective policies is to make sure that the policies are clear, easy to comply with, and realistic. Policies that are overly complicated or controlling will encourage people to bypass the system. If you communicate the need for information security and empower your employees to act if they discover a security issue, you will develop a secure environment where information is safe.
Answer:
anyone know if the other answer in right?
Explanation:
Write a method that evaluates to true or false depending on whether a box completely fits inside another:
public boolean nests( Box outsideBox )
This is potentially a difficult method, since the box may fit or not fit depending on how it is rotated. To simplify the method, write it so that it returns true if the two boxes nest without considering rotations (so height is compared to height, length compared to length, and so on.)
Answer:
box outside box
Explanation:
It is used to display a window with many options, or buttons, in Easy GUI. It can be used in situations when it is necessary to determine which option is the first selection because it returns 1 for buttons with index 0 and 0 for buttons with other indexes.
What public boolean nests contain box outside box?One of the built-in data types in Python is the Boolean type. It serves as a representation of an expression's truth value. For instance, the statement 0 == 1 is False while the statement 1 = 2 is True.
To write effective Python code, one must have a solid understanding of how Python's Boolean values operate.
A boolean value describes the checked attribute. Whenever it is present, it indicates that a checkbox next to an input> element should be selected (checked) before the page loads.
Therefore, The checked attribute can be applied to both checkbox and radio input types. Additionally, JavaScript can be used to modify the checked attribute after the page has loaded.
Learn more about boolean nests here:
https://brainly.com/question/28660200
#SPJ5
According to the vulnerability assessment methodology, vulnerabilities are determined by which 2 factors?
Answer:
3 and 60!
Explanation:
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AND the price of each item, and then simply displays whatever the user typed in on the screen nicely formatted. Some example input might be: Apples 2.10 Hamburger 3.25 Milk 3.49 Sugar 1.99 Bread 1.76 Deli Turkey 7.99 Pickles 3.42 Butter 2.79 Remember - you will be outputting to the screen - so do a screen capture to turn in your output. Also turn in your PYTHON program code.
Answer:
name = []
price = []
for i in range(0,8):
item_name = input('name of item')
item_price = input('price of item')
name.append(item_name)
price.append(item_price)
for i in range(0, 8):
print(name[i], '_____', price[i])
Explanation:
Python code
Using the snippet Given :
Apples 2.10
Hamburger 3.25
Milk 3.49
Sugar 1.99
Bread 1.76
Deli Turkey 7.99
Pickles 3.42
Butter 2.79
name = []
price = []
#name and price are two empty lists
for i in range(0,8):
#Allows users to enter 8 different item and price choices
item_name = input('name of item')
item_price = input('price of item')
#user inputs the various item names and prices
#appends each input to the empty list
name.append(item_name)
price.append(item_price)
for i in range(0, 8):
print(name[i], '_____', price[i])
# this prints the name and prices of each item from the list.
Read Chapter 2 in your text before attempting this project. An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one-and-one-half times that. From the worker's gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker's gross pay, each withholding amount, and the net take-home pay for the week.
Answer:
Answered below
Explanation:
#Answer is written in Python programming language
hrs = int(input("Enter hours worked for the week: "))
dep = int(input ("Enter number of dependants: "))
pay = 16.78
ovpay = pay * 1.5
if hrs <= 40:
wage = hrs * pay
else:
wage = hrs * ovpay
ss = wage * 0.06
fedtax = wage * 0.14
statetax = wage * 0.05
dues = 10
if dep >= 3:
ins = 35
net_pay = wage - ss - fedtax - statetax - dues - ins
print(wage)
print ( ss, fedtax, statetax, dues, ins)
print (net_pay)
In Cloud9, create a new file called function.cpp. If you aren't sure how to create a new .cpp file in the Cloud9 environment, refer Slide 24 of the Cloud9SetUpSlides (Links to an external site.). In this new file write a function called swapInts that swaps (interchanges) the values of two integers that it is given access to via pointer parameters. Write a main function that asks the user for two integer values, stores them in variables num1 and num2, calls the swap function to swap the values of num1
Answer:
#include <iostream>
using namespace std;
void swapInts(int* x, int* y) {
*x = *x + *y;
*y= *x - *y;
*x = *x - *y;
}
int main(){
int num1, num2;
cout << "Before swap:";
cin>>num1; cin>>num2;
swapInts(&num1, &num2);
cout<<"After swap:"<<num1<<" "<<num2;
}
Explanation:
The function begins here:
This line defines the function
void swapInts(int* x, int* y) {
The next three line swap the integer values
*x = *x + *y;
*y= *x - *y;
*x = *x - *y;
}
The main begins here:
int main(){
This line declares two integer variables
int num1, num2;
This line prompts the user for inputs before swap
cout << "Before swap:";
This line gets user inputs for both integers
cin>>num1; cin>>num2;
This line calls the function
swapInts(&num1, &num2);
This prints the numbers after swap
cout<<"After swap:"<<num1<<" "<<num2;
}
Where does the revolver get the IP address of a site not visited before?
the file server
the print spooler
the IP provider
the name server
Answer:
The name server
Explanation:
The correct answer is name servers because on the internet, they usually help web browsers and other services to access the records of the domain name system(DNS) by direction of traffic through connection of the domain name with the IP address of the web server.
PLEASE HELP
This graph shows the efficiencies of two different algorithms that solve the same problem. Which of the following is most efficient?
Answer:
D is correct
Explanation:
Think of it by plugging in values. Clearly the exponential version, according the graph, is more efficient with lower values. But then it can be seen that eventually, the linear will become more efficient as the exponential equation skyrockets. D is the answer.
python program A year with 366 days is called a leap year. Leap years are necessary to keep the calendar in sync with the sun, because the earth revolves around the sun once very 365.25 days. As a result, years that are divisible by 4, like 1996, are leap years. However, years that are divisible by 100, like 1900, are not leap years. But years that are divisible by 400, like 2000, are leap years. Write a program named leap_year.py that asks the user for a year and computes whether that year is a leap year
Answer:
In Python:
year = int(input("Year: "))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("Leap year")
else:
print("Not a leap year")
else:
print("Leap year")
else:
print("Not a leap year")
Explanation:
This line prompts user for year
year = int(input("Year: "))
This condition checks if input year is divisible by 4
if (year % 4) == 0:
If yes, this condition checks if input year is divisible by 100
if (year % 100) == 0:
If yes, this condition checks if input year is divisible by 400
if (year % 400) == 0:
If divisible by 4, 100 and 400, then it is a leap year
print("Leap year")
else:
If divisible by 4 and 100 but not 400, then it is not a leap year
print("Not a leap year")
else:
If divisible by 4 but not 100, then it is a leap year
print("Leap year")
else:
If it is not divisible by, then it is not a leap year
print("Not a leap year")
Create a file named homework_instructions.txt using VI editor and type in it all the submission instructions from page1 of this document. Save the file in a directory named homeworks that you would have created. Set the permissions for this file such that only you can edit the file while anybody can only read. Find and list (on the command prompt) all the statements that contain the word POINTS. Submit your answer as a description of what you did in a sequential manner
Answer:
mkdir homeworks // make a new directory called homeworks.
touch homework_instructions.txt //create a file called homework_instruction
sudo -i // login as root user with password.
chmod u+rwx homework_instructions.txt // allow user access all permissions
chmod go-wx homework_instructions.txt // remove write and execute permissions for group and others if present
chmod go+r homework_instructions.txt // adds read permission to group and others if absent.
grep POINTS homework_instructions.txt | ls -n
Explanation:
The Linux commands above first create a directory and create and save the homework_instructions.txt file in it. The sudo or su command is used to login as a root user to the system to access administrative privileges.
The user permission is configured to read, write and execute the text file while the group and others are only configured to read the file.