Answer:
Yea I am also confused oof
The function retrieveAt of the class arrayListType is written as a void function. Rewrite this function so that it is written as a value returning function, returning the required item. If the location of the item to be returned is out of range, use the assert function to terminate the program. Also, write a program to test your function. Use the class unorderedArrayListType to test your function.
Answer:
int retrieveAt(int location, array){
// Function to retrieve the element from the list at the position
// specified by the location
if (location <= array.size() - 1){
return array[location];
} else{
cout<<"Location out of range";
assert(); // Assuming the assert function is defined in the program.
}
}
Explanation:
The void retrieveAt function is converted to a return function that returns the integer item of the array given the location and the array variable as arguments. The assert function is used to terminate the program.
3 uses of Microsoft word in hospital
Explanation:
You can write, edit and save text in the program.
All operations used to construct algorithms belong to one of three categories: sequential, conditional, or iterative. Below is a list of steps from a variety of algorithms. Determine which category to which each of the steps belong (sequential, conditional, or iterative). If the value of test_grade is between 90 and 100, assign a letter grade of A.
Prompt the user for a number, get number from user
Sequential Repeat steps 3-5 until count = 10
If divisor = 0, print error_message
Complete step 1, complete step 2, complete step 3
Answer:
Answered
Explanation:
1) Conditional category because it uses an IF statement: If value of test grade is between 90-100 assign A.
2) Sequential category: Prompt user for number and get number from user.
3) Iterative category because it is looping: Repeat steps 3-5 until count equals 10.
4)Conditional category: If divisor equals zero print error.
5) Sequential category.
identify the following
Answer:
attachment sign
Explanation:
that is the attachment sign.
Write code that sets the value of a variable named delicious to True if jellybeans is greater than 20, or licorice is greater than 30, or their sum is greater than 40. Otherwise, set it to False. Do NOT use an if statement in your solution. Assume jellybeans and licorice already have values.
Answer:
jellybeans = 10
licorice = 35
delicious = (jellybeans > 20) or (licorice > 30) or ((jellybeans + licorice) > 40)
print(delicious)
Explanation:
*The code is in Python.
Set the jellybeans and licorice to any values you like
In order to have the value of True or False without using the if statement, we need to set delicious as boolean variable. As you may know, boolean variables are the variables that have a value of either True or False
Check if jellybeans is greater than 20 or not → (jellybeans > 20)
Check if licorice is greater than 30 or not → (licorice > 30)
Check if their sum is greater than 40 or not → ((jellybeans + licorice) > 40)
All of the above expressions are boolean expressions. They return True if the statement is correct. Otherwise, they return False
Also, note that we combined all the expressions with or
For these values → jellybeans = 10, licorice = 35:
The first statement returns False
The second statement returns True
The third statement returns True
delicious = False or True or True → True
Note that if the expressions are combined with or, the result will be True if one of the expression is True.
The code that sets the value of a variable named delicious to True if jellybeans is greater than 20, or licorice is greater than 30, or their sum is greater than 40 is as follows:
jellybeans = 30
licorice = 35
delicious = (jellybeans > 20) or (licorice > 30) or (jellybeans + licorice > 40)
print(delicious)
Code explanationThe first line of code, we declared a variable called jellybeans and initialise it to 30.The second line of code, we declared a variable called licorice and initialise it to 35.Then the variable "delicious" is used to store the condition if jelly fish is greater than 20 or if licorice is greater than 30 or the sum of licorice and jellyfish is greater than 40 If any of the condition is true, the print statement will print out True else it will print False.learn more variable here : https://brainly.com/question/19661456?referrer=searchResults
5. In an array-based implementation of the ADT list, the getEntry method locates the entry by a. going directly to the appropriate array element b. searching for the entry starting at the beginning of the array working to the end c. searching for the entry starting at the end of the array working to the beginning d. none of the above
Expert Answer for this question-
Explanation:
Answer- C
The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular forma
Answer:
In Python:
fname = input("Filename: ")
a_file = open(fname)
lines = a_file.readlines()
print("Name\t\tHours\t\tTotal Pay")
for line in lines:
eachline = line.rstrip(" ")
for cont in eachline:
print(cont,end="\t")
print()
Explanation:
This prompts the user for file name
fname = input("Filename: ")
This opens the file
a_file = open(fname)
This reads the lines of the file
lines = a_file.readlines()
This prints the header of the report
print("Name\t\tHours\t\tTotal Pay")
This iterates through the content of each line
for line in lines:
This splits each line into tokens
eachline = line.rstrip(" ")
This iterates through the token and print the content of the file
for cont in eachline:
print(cont,end="\t")
print()
how to view a pivate acont on Intagam
Write C programs that output the following patterns exactly. Use loops to implement the repetitive part of the code. No functions or arrays are allowed?
Answer:
your a legend you can do it just pleave
Explanation:
:)
Computer programming 4
Define a function below, filter_out_strs, which takes a single argument of type list. Complete the function so that it returns a list that contains only the non-strings from the original list. It is acceptable to return an empty list if there are only strings in the original list. This question uses the filter pattern discussed in lecture.
Answer:
Explanation:
The following code is written in Python and is a simple function that removes all of the type String elements within the list that has been passed as an argument. Then finally, prints out the list and returns it to the user.
def filter_out_str(list):
for x in list:
if type(x) == type(" "):
list.remove(x)
print(list)
return list
Following are the python code to hold only string value into another list by using the given method:
Python code:def filter_only_strs(l):#defining the method filter_only_strs that takes list type variable l in parameter
r = []#defining an empty list r
for x in l:#defining a loop that counts value of list
if isinstance(x, str):#using if block that check list value is in string
r.append(x)#using an empty list that holds string value
return r#return list value
l=['d',12,33,"data"]#defining a list l
print(filter_only_strs(l))#calling the method filter_only_strs
Output:
Please find the attached file.
Program Explanation:
Defining the method "filter_out_strs", which takes one argument of list type that is "l".Inside the method, an empty list "r" is defined, and in the next line, a for loop is declared.Inside the for loop list "l" is used with a conditional statement that uses the "isinstance" method that checks string value in the list and adds its value in "r", and returns its value.Find out more about the list in python here:
brainly.com/question/24941798
Which of the following cannot be used in MS Office.
Joystick
Scanner
Light Pen
Mouse
Answer:
A.
Explanation:
A Joystick is a control device that is connected to the computer to play games. A joystick is similar in structure to a control stick used by pilots in airplanes and got its name from the same. A joystick contains a stick, base, extra buttons, auto switch fire, trigger, throttle, POV hat, and a suction cup. A joystick also serves the purpose of assistive technology.
The device which can not be used in MS Office is a joystick. Therefore, option A is correct.