Answer:
Explanation:
Custom function definitions:________.
A. Must be written before they are called by another part of your program
B. Must declare a name for the function
C. Must include information regarding any arguments (if any) that will be passed to the function
D. all of the above
Answer:
D. all of the above
Explanation:
A option is correct and function definition must be written before they are called by another part of your program. But in languages such as C++ you can write the prototype of the function before it is called anywhere in the program and later write the complete function implementation. I will give an example in Python:
def addition(a,b): #this is the definition of function addition
c = a + b
return c
print(addition(1,3)) #this is where the function is called
B option is correct and function definition must declare a name for the function. If you see the above given function, its name is declared as addition
C option is correct and function definition must include information regarding any arguments (if any) that will be passed to the function. In the above given example the arguments are a and b. If we define the above function in C++ it becomes: int addition( int a, int b)
This gives information that the two variables a and b that are parameters of the function addition are of type int so they can hold integer values only.
Hence option D is the correct answer. All of the above options are correct.
Reading for comprehension requires _____ reading?
1. passive
2. active
3. slow
4. fast
Answer:
IT is ACTIVE
Explanation: I took the quiz
Answer:
not sure sorry
Explanation:
Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two individual for a particular year is exactly the same, you should print an error and make the user enter both the salaries again for that year. (The condition is that there salaries should not be the exact same).Your program should accept from the user the salaries for each individual one year at a time. When the user is finished entering the salaries, the program should print which individual made the highest total salary over the 5 year period. This is the individual whose salary is the highest.You have to use arrays and loops in this assignment.In the sample output examples, what the user entered is shownin italics.Welcome to the winning card program.
Enter the salary individual 1 got in year 1>10000
Enter the salary individual 2 got in year 1 >50000
Enter the salary individual 1 got in year 2 >30000
Enter the salary individual 2 got in year 2 >50000
Enter the salary individual 1 got in year 3>35000
Enter the salary individual 2 got in year 3 >105000
Enter the salary individual 1 got in year 4>85000
Enter the salary individual 2 got in year 4 >68000
Enter the salary individual 1 got in year 5>75000
Enter the salary individual 2 got in year 5 >100000
Individual 2 has the highest salary
In python:
i = 1
lst1 = ([])
lst2 = ([])
while i <= 5:
person1 = int(input("Enter the salary individual 1 got in year {}".format(i)))
person2 = int(input("Enter the salary individual 1 got in year {}".format(i)))
lst1.append(person1)
lst2.append(person2)
i += 1
if sum(lst1) > sum(lst2):
print("Individual 1 has the highest salary")
else:
print("Individual 2 has the highest salary")
This works correctly if the two individuals do not end up with the same salary overall.
For this lab you will do 2 things:
Solve the problem in an algorithm
Code it in Python
Problem:
Cookie Calories
A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 "servings" in the bag and that a serving equals 300 calories. Write a program that asks the user to input how many cookies he or she ate and the reports how many total calories were consumed.
*You MUST use constants to represent the number of cookies in the bag, number of servings, and number of calories per serving. Remember to put constants in all caps!
Make sure to declare and initialize all variables before using them!
Then you can do the math using those constants to find the number of calories in each cookie.
Make this program your own by personalizing the introduction and output.
Sample Output:
WELCOME TO THE CALORIE COUNTER!!
Answer:
Here is the Python program:
COOKIES_PER_BAG = 40 #sets constant value for bag of cookies
SERVINGS_PER_BAG = 10 #sets constant value for serving in bag
CALORIES_PER_SERVING = 300 #sets constant value servings per bag
cookies = int(input("How many cookies did you eat? ")) #prompts user to input how many cookies he or she ate
totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG)); #computes total calories consumed by user
print("Total calories consumed:",totalCalories) #displays the computed value of totalCalories consumed
Explanation:
The algorithm is:
StartDeclare constants COOKIES_PER_BAG, SERVINGS_PER_BAG and CALORIES_PER_SERVINGSet COOKIES_PER_BAG to 40Set SERVINGS_PER_BAG to 10Set CALORIES_PER_SERVING to 300Input cookiesCalculate totalCalories: totalCalories ← cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG))Display totalCaloriesI will explain the program with an example:
Lets say user enters 5 as cookies he or she ate so
cookies = 5
Now total calories are computed as:
totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG));
This becomes:
totalCalories = 5 * (300/40/10)
totalCalories = 5 * (300/4)
totalCalories = 5 * 75
totalCalories = 375
The screenshot of program along with its output is attached.
(d) Assume charArray is a character array with 20 elements stored in memory and its starting memory address is in $t5. What is the memory address for element charArray[5]?
Answer:
$t5 + 5
Explanation:
Given that ;
A character array defines as :
charArray
Number of elements in charArray = 20
Starting memory address is in $t5
The memory address for element charArray[5]
Memory address for charArray[5] will be :
Starting memory address + 5 :
$t5 + 5
Which situation best illustrates how traditional economies meet their citizens needs for employment and income
APEX!!
A. A parent teaches a child to farm using centuries old techniques.
B. A religious organization selects a young person to become a priest
C. A government agency assigns a laborer a job working in a factory
D. A corporation hires an engineer who has just graduated from college
The situation that best show how traditional economies meet their citizens needs for employment and income is that a parent teaches a child to farm using centuries old techniques.
What is a traditional economy about?A traditional economy is known to be a type of system that depends on customs, history, and time framed/honored beliefs.
Tradition is know to be the guide that help in economic decisions such as production and distribution. Regions with traditional economies are known to depend on agriculture, fishing, hunting, etc.
Learn more about traditional economies from
https://brainly.com/question/620306
What is a piece of information sent to a function
Answer:
the information sent to a function is the 'input'.
or maybe not hehe
Write a program that computes and display the n! for any n in the range1...100
Answer:
const BigNumber = require('bignumber.js');
var f = new BigNumber("1");
for (let i=1; i <= 100; i++) {
f = f.times(i);
console.log(`${i}! = ${f.toFixed()}`);
}
Explanation:
Above is a solution in javascript. You will need a bignumber library to display the numbers in full precision.
Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System.
a. True
b. False
Answer:
a
Explanation:
Yes, true.
Shortest Remaining Time First, also popularly referred to by the acronym SRTF, is a type of scheduling algorithm, used in operating systems. Other times it's not called by its name nor its acronym, it is called the preemptive version of SJF scheduling algorithm. The SJF scheduling algorithm is another type of scheduling algorithm.
The Shortest Remaining Time First has been touted by many to be faster than the SJF
The answer to the question which asks if the Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System is:
TrueWhat is Shortest Remaining Time First?This refers to the type of scheduling algorithm which is used to schedule tasks that would be executed in the processing unit in an Operating System based on the shortest time taken to execute the task.
With this in mind, we can see that this is the best preemptive scheduling algorithm that can be implemented in an Operating System because it makes task execution faster.
Read more about scheduling algorithm here:
https://brainly.com/question/15191620
Type the correct answer in the box
in which phishing technique are URLs of the spoofed organization misspelled?
anon
is a phishing technique in which URLs of the spoofed organization are misspelled
Answer: Link manipulation
Explanation:
Answer:
Typo Squatting
Explanation:
Choose the word to make the sentence true. The ____ function is used to display the program's output.
O input
O output
O display
The output function is used to display the program's output.
Explanation:
As far as I know this must be the answer. As tge output devices such as Monitor and Speaker displays the output processed.
The display function is used to display the program's output. The correct option is C.
What is display function?Display Function Usage displays a list of function identifiers. It can also be used to display detailed usage information about a specific function, such as a list of user profiles with the function's specific usage information.
The displayed values include the prefix, measuring unit, and required decimal places.
Push buttons can be used to select functions such as summation, minimum and maximum value output, and tare. A variety of user inputs are available.
A display is a device that displays visual information. The primary goal of any display technology is to make information sharing easier. The display function is used to display the output of the program.
Thus, the correct option is C.
For more details regarding display function, visit:
https://brainly.com/question/29216888
#SPJ5
What does the measurement tell you?
Schedule performance index
Answer:
how close the project is to being completed compared to the schedule/ how far ahead or behind schedule the project is, relative to the overall project
Explanation:
The hide/unhide feature only hides in the
_____ view?
Answer: main...?
Explanation:
Question 8 (3 points) Which of the following is an external factor that affects the price of a product? Choose the answer.
sales salaries
marketing strategy
competition
production cost
Answer: tax
Explanation: could effect the cost of items because the tax makes the price higher
oh sorry i did not see the whole question
this is the wrong awnser
You want to look up colleges but exclude private schools. Including punctuation, what would you
type?
O nonprofit college
O college -private
O private -college
O nonprofit -college
You want to look up colleges but exclude private schools. Including punctuation, The type is private -college. The correct option is c.
What are institutions of higher studies?The institutions for higher studies are those institutions that provide education after schooling. They are colleges and universities. Universities, colleges, and professional schools that offer training in subjects like law, theology, medicine, business, music, and art are all considered higher education institutions.
Junior colleges, institutes of technology, and schools for future teachers are also considered to be part of higher education. There are different types of colleges, like government colleges and private colleges. Private colleges are those which are funded by private institutions.
Therefore, the correct option is c. private -college.
To learn more about excluding, refer to the link:
https://brainly.com/question/27246973
#SPJ2
For everyday files that users will use regularly on a user's own Word-compatible computer, the best file format to save as is: o PDF. DOCX ORTE. OTXT.
Answer:
DOCX? I think
Explanation:
Write a program that finds the number of items above the average of all items. The problem is to read 100 numbers, get the average of these numbers, and find the number of the items greater than the average. To be flexible for handling any number of input, we will let the user enter the number of input, rather than fixing it to 100.
Answer:
Written in Python
num = int(input("Items: "))
myitems = []
total = 0
for i in range(0, num):
item = int(input("Number: "))
myitems.append(item)
total = total + item
average = total/num
print("Average: "+str(average))
count = 0
for i in range(0,num):
if myitems[i] > average:
count = count+1
print("There are "+str(count)+" items greater than average")
Explanation:
This prompts user for number of items
num = int(input("Items: "))
This creates an empty list
myitems = []
This initializes total to 0
total = 0
The following iteration gets user input for each item and also calculates the total
for i in range(0, num):
item = int(input("Number: "))
myitems.append(item)
total = total + item
This calculates the average
average = total/num
This prints the average
print("Average: "+str(average))
This initializes count to 0
count = 0
The following iteration counts items greater than average
for i in range(0,num):
if myitems[i] > average:
count = count+1
This prints the count of items greater than average
print("There are "+str(count)+" items greater than average")
Which online text source would include a review of a new TV show?
an academic journal
a blog
an e-book
an encyclopedia
Answer:
Blog
Explanation:
Online text sources include blogs, e-books, encyclopaedias, and e-zines. As a result, options A, B, C, and D are correct.
What is a text source?A source is a book or other material that contains the data that has been used, whereas a citation is the actual statement of the starting point. They were researchers who also worked as professors, writers, and other professionals, and they published books and articles.
Online text sources are those that can be accessed from anywhere and are available on the internet. The online text shows that anyone can see or exceed including blogs, e-books, encyclopaedias, and e-zines.
These are available for further studies and research. Also to give information this can be a source. Therefore, options A, B, C, and E is the correct option.
Learn more about text sources, here:
brainly.com/question/19131568
#SPJ6
The state way of grading drivers is called what?
*
Select the items that you may see on a Windows desktop.
Shortcuts to frequently used programs
System tray
Recycle Bin
Taskbar
O Database
Icons
O Quick Launch
Answer:
You may see:
The taskbar
The startmenu
Program icons within the taskbar
Shortcuts
Documents
Folders
Media files
Text files
The Recycle Bin
and so on...
Write a function that takes a string and return the back half of the string. If the string has an odd number of characters, include the extra character. Your solution should also work if given and empty string. Examples: back_half('abba') should return 'ba' back_half('abcba') should return 'cba'
Answer:
Written in Python
def back_half(inputstring):
outputstring = ""
lent = len(inputstring)
if lent == 0:
outputstring ="Empty String"
elif lent%2 == 0:
begin = lent/2
for i in range(int(begin),lent):
outputstring = outputstring + inputstring[i]
else:
begin = (lent+1)/2
for i in range(int(begin-1),lent):
outputstring = outputstring + inputstring[i]
return outputstring
Explanation:
This line defines the function
def back_half(inputstring):
This line initializes outputstring to an empty string
outputstring = ""
This calculates the length of the input string
lent = len(inputstring)
This checks if the length of inputstring is 0. If yes, the function returns empty string
if lent == 0:
outputstring ="Empty String"
This checks if the length of inputstring is even.
elif lent%2 == 0:
begin = lent/2 This line gets the beginning of the half string
for i in range(int(begin),lent):
outputstring = outputstring + inputstring[i] This generates the half string
else: This checks for odd length
begin = (lent+1)/2 This line gets the beginning of the half string
for i in range(int(begin-1),lent):
outputstring = outputstring + inputstring[i] This generates the half string
return outputstring This returns the outputstring
This assignment requires you to write a well documented Java program to calculate the total and average of three scores, the letter grade, and output the results. Your program must do the following:
Prompt and read the users first and last name
Prompt and read three integer scores
Calculate the total and average
Determine a letter grade based on the following grading scale - 90-100 A; 80-89.99 B; 70-79.99 C; below 70 F
Use the printf method to output the full name, the three scores, the total, average, and the letter grade, properly formatted and on separate lines.
Within the program include a pledge that this program is solely your work and the IDE used to create/test/execute the program. Please submit the source code/.java file to Blackboard. Attached is a quick reference for the printf method.
Answer:
The solution is given in the explanation section
Don't forget to add the pledge before submitting it. Also, remember to state the IDE which you are familiar with, I have used the intellij IDEA
Follow through the comments for a detailed explanation of each step
Explanation:
/*This is a Java program to calculate the total and average of three scores, the letter grade, and output the results*/
// Importing the Scanner class to receive user input
import java.util.Scanner;
class Main {
public static void main(String[] args) {
//Make an object of the scaner class
Scanner in = new Scanner(System.in);
//Prompt and receive user first and last name;
System.out.println("Please enter your first name");
String First_name = in.next();
System.out.println("Please enter your Last name");
String Last_name = in.next();
//Prompt and receive The three integer scores;
System.out.println("Please enter score for course one");
int courseOneScore = in.nextInt();
System.out.println("Please enter score for course two");
int courseTwoScore = in.nextInt();
System.out.println("Please enter score for course three");
int courseThreeScore = in.nextInt();
//Calculating the total scores and average
int totalScores = courseOneScore+courseTwoScore+courseThreeScore;
double averageScore = totalScores/3;
/*Use if..Else statements to Determine a letter grade based on the following grading scale - 90-100 A; 80-89.99 B; 70-79.99 C; below 70 F */
char letterGrade;
if(averageScore>=90){
letterGrade = 'A';
}
else if(averageScore>=80 && averageScore<=89.99){
letterGrade = 'B';
}
else if(averageScore>=70 && averageScore<=79.99){
letterGrade = 'C';
}
else{
letterGrade ='F';
}
//Printing out the required messages
System.out.printf("Name: %s %s\n", First_name, Last_name);
System.out.printf("scores: %d %d %d: \n", courseOneScore, courseTwoScore, courseThreeScore);
System.out.printf("Total and Average Score is: %d %.2f: \n", totalScores, averageScore);
System.out.printf("Letter Grade: %C: \n", letterGrade);
// System.out.printf("Total: %-10.2f: ", dblTotal);
}
}
what is the use of buffer?
Answer:
pH buffer or hydrogen ion buffer) is an aqueous solution consisting of a mixture of a weak acid and its conjugate base, or vice versa. ... Buffer solutions are used as a means of keeping pH at a nearly constant value in a wide variety of chemical applications.
Explanation:
there is your answer i got this one correct
hope it is helpful
Answer:
Limits the pH of a solution
Explanation:
A P E X
Describe how to manage the workspace by putting each feature under the action it helps carry out
Answer:
Viewing Documents one at a time:Windows+tab keys,
Windows taskbar
Viewing documents at same time:
Snap,Arrange all
Explanation:
The workspace can be managed by putting control of the surroundings it's far important that you examine all of the factors and items found in your area.
What is the workplace for?Workspaces had been round in Ubuntu properly earlier than the transfer to Unity. They essentially offer you a manner to organization home windows associated with comparable duties together, in addition to get "additional" screenspace.
The subsequent step is to outline a logical and optimizing feature for the factors with a view to continuing to be on your surroundings, defining that each of them may be capable of carrying out an easy and applicable project for his or her paintings.
Read more about the workspace :
https://brainly.com/question/26463698
#SPJ2
Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which principal of programing should Alice review?
Answer:
sequencing
Explanation:
from flvs
Answer:
Sequencing
Explanation:
There is a company of name "Baga" and it produces differenty kinds of mobiles. Below is the list of model name of the moble and it's price model_name Price reder-x 50000 yphone 20000 trapo 25000 Write commands to set the model name and price under the key name as corresponding model name how we can do this in Redis ?
Answer:
Microsoft Word can dohjr iiejdnff jfujd and
Microsoft Word can write commands to set the model name and price under the key name as corresponding model.
What is Microsoft word?One of the top programs for viewing, sharing, editing, managing, and creating word documents on a Windows PC is Microsoft Word. The user interface of this program is straightforward, unlike that of PaperPort, CintaNotes, and Evernote.
Word documents are useful for organizing your notes whether you're a blogger, project manager, student, or writer. Because of this, Microsoft Word has consistently been a component of the Microsoft Office Suite, which is used by millions of people worldwide.
Although Microsoft Word has traditionally been connected to Windows PCs, the program is also accessible on Mac and Android devices. The most recent version of Microsoft Office Word.
Therefore, Microsoft Word can write commands to set the model name and price under the key name as corresponding model.
To learn more about microsoft word, refer to the link:
https://brainly.com/question/26695071
#SPJ5
1.2
Is media a curse or a blessing? Explain.
Answer:
i think its both because if there is misunderstanding between media and government then the media distroys the government and if there us no misunderstanding between media and government and if it goes smoothly then its like a blessing for government
Answer:
Media is a blessing...a curse as well when it's misguiding the world and hiding the real sinner and juxtaposing the culprit as the saviour
PV = 11,000 AC = 6000 CV = 4,000. What is SV? What does this calculation tell you?
Answer:
I don't see an SV in the examples.. I suspect these are the name plate numbers off of a transformer... but.. more context would really help
Explanation:
To write a letter using Word Online, which document layout should you choose? ASAP PLZ!
Traditional... See image below
Answer: new blank document
Explanation: trust is key
In this exercise you will debug the code which has been provided in the starter file. The code is intended to take two strings, s1 and s2 followed by a whole number, n, as inputs from the user, then print a string made up of the first n letters of s1 and the last n letters of s2. Your job is to fix the errors in the code so it performs as expected (see the sample run for an example).
Sample run
Enter first string
sausage
Enter second string
races
Enter number of letters from each word
3
sauces
Note: you are not expected to make your code work when n is bigger than the length of either string.
1 import java.util.Scanner;
2
3 public class 02_14_Activity_one {
4 public static void main(String[] args) {
5
6 Scanner scan = Scanner(System.in);
7
8 //Get first string
9 System.out.println("Enter first string");
10 String s1 = nextLine(); 1
11
12 //Get second string
13 System.out.println("Enter second string");
14 String s2 = Scanner.nextLine();
15
16 //Get number of letters to use from each string
17 System.out.println("Enter number of letters from each word");
18 String n = scan.nextLine();
19
20 //Print start of first string and end of second string
21 System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));
22
23
24 }
Answer:
Here is the corrected program:
import java.util.Scanner; //to accept input from user
public class 02_14_Activity_one { //class name
public static void main(String[] args) { //start of main method
Scanner scan = new Scanner(System.in); //creates Scanner class object
System.out.println("Enter first string"); //prompts user to enter first string
String s1 = scan.nextLine(); //reads input string from user
System.out.println("Enter second string"); //prompts user to enter second string
String s2 = scan.nextLine(); //reads second input string from user
System.out.println("Enter number of letters from each word"); //enter n
int n = scan.nextInt(); //reads value of integer n from user
System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));
} } //uses substring method to print a string made up of the first n letters of s1 and the last n letters of s2.
Explanation:
The errors were:
1.
Scanner scan = Scanner(System.in);
Here new keyword is missing to create object scan of Scanner class.
Corrected statement:
Scanner scan = new Scanner(System.in);
2.
String s1 = nextLine();
Here object scan is missing to call nextLine() method of class Scanner
Corrected statement:
String s1 = scan.nextLine();
3.
String s2 = Scanner.nextLine();
Here class is used instead of its object scan to access the method nextLine
Corrected statement:
String s2 = scan.nextLine();
4.
String n = scan.nextLine();
Here n is of type String but n is a whole number so it should be of type int. Also the method nextInt will be used to scan and accept an integer value
Corrected statement:
int n = scan.nextInt();
5.
System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));
This statement is also not correct
Corrected statement:
System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));
This works as follows:
s1.substring(0,n) uses substring method to return a new string that is a substring of this s1. The substring begins at the 0th index of s1 and extends to the character at index n.
s2.substring(s2.length() - n ) uses substring method to return a new string that is a substring of this s2. The substring then uses length() method to get the length of s2 and subtracts integer n from it and thus returns the last n characters of s2.
The screenshot of program along with its output is attached.