Answer:
String longest = "";
Explanation:
The initialization that would allow the method to work as intended would be the following
String longest = "";
This is because the method is looping through the array provided as an argument and comparing each word in the array with the word saved inside the variable called longest. The length of both are compared and if the word in the array is longer than the string saved in the variable longest then it is overwritten with the word in the array.
Consider the following code segment. int[][] arr = {{3, 2, 1}, {4, 3, 5}}; for (int row = 0; row < arr.length; row++) { for (int col = 0; col < arr[row].length; col++) { if (col > 0) { if (arr[row][col] >= arr[row][col - 1]) { System.out.println("Condition one"); } } if (arr[row][col] % 2 == 0) { System.out.println("Condition two"); } } } As a result of executing the code segment, how many times are "Condition one" and "Condition two" printed?
Answer:
Condition one - 1 time
Condition two - 2 times
Explanation:
Given
The above code segment
Required
Determine the number of times each print statement is executed
For condition one:
The if condition required to print the statement is: if (arr[row][col] >= arr[row][col - 1])
For the given data array, this condition is true only once, when
[tex]row = 1[/tex] and [tex]col = 2[/tex]
i.e.
if(arr[row][col] >= arr[row][col - 1])
=> arr[1][2] >= arr[1][2 - 1]
=> arr[1][2] >= arr[1][1]
=> 5 >= 3 ---- True
The statement is false for other elements of the array
Hence, Condition one is printed once
For condition two:
The if condition required to print the statement is: if (arr[row][col] % 2 == 0)
The condition checks if the array element is divisible by 2.
For the given data array, this condition is true only two times, when
[tex]row = 0[/tex] and [tex]col = 1[/tex]
[tex]row = 1[/tex] and [tex]col = 0[/tex]
i.e.
if (arr[row][col] % 2 == 0)
When [tex]row = 0[/tex] and [tex]col = 1[/tex]
=>arr[0][1] % 2 == 0
=>2 % 2 == 0 --- True
When [tex]row = 1[/tex] and [tex]col = 0[/tex]
=>arr[1][0] % 2 == 0
=> 4 % 2 == 0 --- True
The statement is false for other elements of the array
Hence, Condition two is printed twice
(1) Prompt the user for an automobile service. Output the user's input. (1 pt) Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts) Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not l
Answer:
In Python:
#1
service = input("Enter desired auto service: ")
print("You entered: "+service)
#2
if service.lower() == "oil change":
print("Cost of oil change: $35")
elif service.lower() == "car wash":
print("Cost of car wash: $7")
elif service.lower() == "tire rotation":
print("Cost of tire rotation: $19")
else:
print("Invalid Service")
Explanation:
First, we prompt the user for the auto service
service = input("Enter desired auto service: ")
Next, we print the service entered
print("You entered: "+service)
Next, we check if the service entered is available (irrespective of the sentence case used for input). If yes, the cost of the service is printed.
This is achieved using the following if conditions
For Oil Change
if service.lower() == "oil change":
print("Cost of oil change: $35")
For Car wash
elif service.lower() == "car wash":
print("Cost of car wash: $7")
For Tire rotation
elif service.lower() == "tire rotation":
print("Cost of tire rotation: $19")
Any service different from the above three, is invalid
else:
print("Invalid Service")
Last one, this is fashion marketing and I need to know the answer to get the 80%
Answer:
D. It requires that each item of stock is counted and recorded to determine stock levels
Explanation:
A perpetual system of inventory can be defined as a method of financial accounting, which involves the updating informations about an inventory on a continuous basis (in real-time) as the sales or purchases are being made by the customers, through the use of enterprise management software applications and a digitized point-of-sale (POS) equipment.
Under a perpetual system of inventory, updates of the journal entry for cost of goods sold or received would include debiting accounts receivable and crediting sales immediately as it is being made or happening.
Hence, an advantage of the perpetual system of inventory over the periodic system of inventory is that, it ensures the inventory account balance is always accurate provided there are no spoilage, theft etc.
The following are the characteristic of a perpetual inventory system;
I. It is the most popular choice for modern business.
II. Inventory is updated in near real-time.
III. It provides up-to-date balance information and requires fewer physical counts.
developed the first compiler and conducted work that led to the development of COBOL ?
Answer:
Grace Hopper.
Explanation:
Grace Hopper was a US Naval Rear Admiral and an American computer scientist who was born on the 9th of December, 1906 in New York city, United States of America. She worked on the first commercial computer known as universal automatic computer (UNIVAC), after the second World War II.
In 1953 at the Remington Rand, Grace Hopper invented the first high-level programming language for UNIVAC 1 by using words and expressions.
Additionally, the high-level programming language known as FLOW-MATIC that she invented in 1953 paved the way for the development of common business-oriented language (COBOL).
Hence, Grace Hopper developed the first compiler and conducted work that led to the development of COBOL.
Drag the tiles to the correct boxes to complete the pairs.
Match each type of database to its application
Multistage
Stationary
Distributed
Virtual
used for concise as well as detailed
historical data
arrowRight
used where access to data is rare
arrowRight
used for accessing data in diverse
applications using middleware
arrowRight
used by an organization that runs
several businesses
arrowRight
Answer:
1. Multistage database.
2. Stationary database.
3. Virtual database.
4. Distributed database.
Explanation:
A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.
There are four (4) major types of database in a data warehouse and these are;
1. Multistage database: used for concise as well as detailed historical data. It provides summarized data which can be used by an employee for short-term decision making.
2. Stationary database: used where access to data is rare i.e business firms who do not access data frequently. In order to use this database, the users must have an access to metadata store and thus, directly having access to the data on a source system.
3. Virtual database: used for accessing data in diverse applications using middleware. This type of database is dependent on having access to information on various databases.
4. Distributed database: used by an organization that runs several businesses. Therefore, this type of database are usually located or situated in various geographical regions.
You've created a new programming language, and now you've decided to add hashmap support to it. Actually you are quite disappointed that in common programming languages it's impossible to add a number to all hashmap keys, or all its values. So you've decided to take matters into your own hands and implement your own hashmap in your new language that has the following operations:
insert x y - insert an object with key x and value y.
get x - return the value of an object with key x.
addToKey x - add x to all keys in map.
addToValue y - add y to all values in map.
To test out your new hashmap, you have a list of queries in the form of two arrays: queryTypes contains the names of the methods to be called (eg: insert, get, etc), and queries contains the arguments for those methods (the x and y values).
Your task is to implement this hashmap, apply the given queries, and to find the sum of all the results for get operations.
Example
For queryType = ["insert", "insert", "addToValue", "addToKey", "get"] and query = [[1, 2], [2, 3], [2], [1], [3]], the output should be hashMap(queryType, query) = 5.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 2, 2: 3}
3 query: {1: 4, 2: 5}
4 query: {2: 4, 3: 5}
5 query: answer is 5
The result of the last get query for 3 is 5 in the resulting hashmap.
For queryType = ["insert", "addToValue", "get", "insert", "addToKey", "addToValue", "get"] and query = [[1, 2], [2], [1], [2, 3], [1], [-1], [3]], the output should be hashMap(queryType, query) = 6.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 4}
3 query: answer is 4
4 query: {1: 4, 2: 3}
5 query: {2: 4, 3: 3}
6 query: {2: 3, 3: 2}
7 query: answer is 2
The sum of the results for all the get queries is equal to 4 + 2 = 6.
Input/Output
[execution time limit] 4 seconds (py3)
[input] array.string queryType
Array of query types. It is guaranteed that each queryType[i] is either "addToKey", "addToValue", "get", or "insert".
Guaranteed constraints:
1 ≤ queryType.length ≤ 105.
[input] array.array.integer query
Array of queries, where each query is represented either by two numbers for insert query or by one number for other queries. It is guaranteed that during all queries all keys and values are in the range [-109, 109].
Guaranteed constraints:
query.length = queryType.length,
1 ≤ query[i].length ≤ 2.
[output] integer64
The sum of the results for all get queries.
[Python3] Syntax Tips
# Prints help message to the console
# Returns a string
def helloWorld(name):
print("This prints to the console when you Run Tests")
return "Hello, " + name
Answer:
Attached please find my solution in JAVA
Explanation:
long hashMap(String[] queryType, int[][] query) {
long sum = 0;
Integer currKey = 0;
Integer currValue = 0;
Map<Integer, Integer> values = new HashMap<>();
for (int i = 0; i < queryType.length; i++) {
String currQuery = queryType[i];
switch (currQuery) {
case "insert":
HashMap<Integer, Integer> copiedValues = new HashMap<>();
if (currKey != 0 || currValue != 0) {
Set<Integer> keys = values.keySet();
for (Integer key : keys) {
copiedValues.put(key + currKey, values.get(key) + currValue);
}
values.clear();
values.putAll(copiedValues);
currValue = 0;
currKey = 0;
}
values.put(query[i][0], query[i][1]);
break;
case "addToValue":
currValue += values.isEmpty() ? 0 : query[i][0];
break;
case "addToKey":
currKey += values.isEmpty() ? 0 : query[i][0];
break;
case "get":
copiedValues = new HashMap<>();
if (currKey != 0 || currValue != 0) {
Set<Integer> keys = values.keySet();
for (Integer key : keys) {
copiedValues.put(key + currKey, values.get(key) + currValue);
}
values.clear();
values.putAll(copiedValues);
currValue = 0;
currKey = 0;
}
sum += values.get(query[i][0]);
}
}
return sum;
}
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.
When importing data using the Get External Data tools on the Data tab, what wizard is automatically
started after selecting the file you want, to help import the data?
Text Import Wizard
Excel Data Wizard
Import Wizard
Text Wrap Wizard
Answer: text import wizard
Explanation:
During TCP/IP communications between two network hosts, information is encapsulated on the sending host and decapsulated on the receiving host using the OSI model. Match the information format with the appropriate layer of the OSI model.
a. Packets
b. Segments
c. Bits
d. Frames
1. Session Layer
2. Transport Layer
3. Network Layer
4. Data Link Layer
5. Physical Layer
Answer:
a. Packets - Network layer
b. Segments - Transport layer
c. Bits - Physical layer
d. Frames - Data link layer
Explanation:
When TCP/IP protocols are used for communication between two network hosts, there is a process of coding and decoding also called encapsulation and decapsulation.
This ensures the information is not accessible by other parties except the two hosts involved.
Operating Systems Interconnected model (OSI) is used to standardise communication in a computing system.
There are 7 layers used in the OSI model:
1. Session Layer
2. Transport Layer
3. Network Layer
4. Data Link Layer
5. Physical Layer
6. Presentation layer
7. Application layer
The information formats given are matched as
a. Packets - Network layer
b. Segments - Transport layer
c. Bits - Physical layer
d. Frames - Data link layer
The Clean Air Act Amendments of 1990 prohibit service-related releases of all ____________. A) GasB) OzoneC) MercuryD) Refrigerants
Answer:
D. Refrigerants
Explanation:
In the United States of America, the agency which was established by US Congress and saddled with the responsibility of overseeing all aspects of pollution, environmental clean up, pesticide use, contamination, and hazardous waste spills is the Environmental Protection Agency (EPA). Also, EPA research solutions, policy development, and enforcement of regulations through the resource Conservation and Recovery Act .
The Clean Air Act Amendments of 1990 prohibit service-related releases of all refrigerants such as R-12 and R-134a. This ban became effective on the 1st of January, 1993.
Refrigerants refers to any chemical substance that undergoes a phase change (liquid and gas) so as to enable the cooling and freezing of materials. They are typically used in air conditioners, refrigerators, water dispensers, etc.
Answer:
D
Explanation:
In which cloud service model, virtual machines are provisioned? Iaas
Answer:
SaaS is the cloud service in which virtual machines are provisioned
Mark is a stockbroker in New York City. He recently asked you to develop a program for his company. He is looking for a program that will calculate how much each person will pay for stocks. The amount that the user will pay is based on:
The number of stocks the Person wants * The current stock price * 20% commission rate.
He hopes that the program will show the customer’s name, the Stock name, and the final cost.
The Program will need to do the following:
Take in the customer’s name.
Take in the stock name.
Take in the number of stocks the customer wants to buy.
Take in the current stock price.
Calculate and display the amount that each user will pay.
A good example of output would be:
May Lou
you wish to buy stocks from APPL
the final cost is $2698.90
ok sorry i cant help u with this
Help need right now pls
Read the following Python code:
yards - 26
hexadecimalYards = hex (yards)
print (hexadecimalYards)
Which of the following is the correct output? (5 points)
A. 0b1a
B. 0d1a
C. 0h1a
D. 0x1a
Answer:
d. 0x1a
Explanation:
You are considering upgrading memory on a laptop. What are three attributes of currently installed memory that HWiNFO can give to help you with this decision?
Answer:
Some of the qualities of the installed memory which HWiNFO can reveal are:
Date of manufactureMemory type Speed of memoryExplanation:
HWiNFO is an open-source systems information app/tool which Windows users can utilize as they best wish. It helps to detect information about the make-up of computers especially hardware.
If you used HWiNFO to diagnose the memory, the following information will be called up:
the total size of the memory and its current performance settingsthe size of each module, its manufacturer, and model Date of manufactureMemory type Speed of memorysupported burst lengths and module timings, write recovery time etc.Cheers
Write a program that calculates the tip and total amount to pay per person given the bill. The program gets the bill, tip percentage and number of people as input and outputs the amount of tip per person and total per person. Check the Programming Guideline document on Blackboard to know what to submit. Sample run given below where the red bold numbers are the inputs from the user: TIP CALCULATOR Enter the bill : 20.25 Enter the percentage of the tip : 20 Enter the number of people : 3 Tip per person is $1.35 and total per person is $8.10.
Answer:
Answered below.
Explanation:
#program is written in Python programming language
#Get inputs
bill = float(input('Enter bill: "))
tip = float(input("Enter tip percentage: "))
people = float(input ("Enter number of people: ")
#calculations
amount_per_person = bill / people
tip_per_person = amount_per_person * tip
total_per_person = amount_per_person + tip_per_person
#output
print(tip_per_person)
print (total_per_person)
Implement the method countInitial which accepts as parameters an ArrayList of Strings and a letter, stored in a String. (Precondition: the String letter has only one character. You do not need to check for this.) The method should return the number of Strings in the input ArrayList that start with the given letter. Your implementation should ignore the case of the Strings in the ArrayList. Hint - the algorithm to implement this method is just a modified version of the linear search algorithm. Use the runner class to test your method but do not add a main method to your U7_L4_Activity_One.java file or your code will not be scored correctly.
Answer:
Answered below
Explanation:
//Program is implemented in Java
public int countInitials(ArrayList<string> words, char letter){
int count = 0;
int i;
for(i = 0; i < words.length; i++){
if ( words[i][0]) == letter){
count++
}
}
return count;
}
//Test class
Class Test{
public static void main (String args[]){
ArrayList<string> words = new ArrayList<string>()
words.add("boy");
words.add("bell");
words.add("cat");
char letter = 'y';
int numWords = countInitials ( words, letter);
System.out.print(numWords);
}
}
What is the difference of using Selection Tool and Direct Selection Tool?
Answer:
The Selection tool will always select the object as a whole. Use this tool when you want to manipulate the entire object. The Direct Selection tool will always select the points or segments that make up a frame
Explanation:
You are a computer consultant called in to a manufacturing plant. The plant engineer needs a system to control their assembly line that includes robotic arms and conveyors. Many sensors are used and precise timing is required to manufacture the product. Of the following choices, which OS would you recommend to be used on the computing system that controls the assembly line and why
Answer:
Linux operating system is suitable for the operation of the automated system because it is more secure with a free open-source codebase to acquire and create new applications on the platform.
Explanation:
Linux operating system is open-source software for managing the applications and network functionalities of a computer system and its networks. It has a general public license and its code is available to users to upgrade and share with other users.
The OS allows user to configure their system however they chose to and provides a sense of security based on user privacy.
Write a method named removeRange that accepts an ArrayList of integers and two integer values min and max as parameters and removes all elements values in the range min through max (inclusive). For example, if an ArrayList named list stores [7, 9, 4, 2, 7, 7, 5, 3, 5, 1, 7, 8, 6, 7], the call of removeRange(list, 5, 7); should change the list to store [9, 4, 2, 3, 1, 8
Answer:
Answered below
Explanation:
public ArrayList<Integer> removeRange(ArrayList<Integer> X, int min, int max){
int i; int j;
//Variable to hold new list without elements in //given range.
ArrayList<Integer> newList = new ArrayList<Integer>();
//Nested loops to compare list elements to //range elements.
if(max >= min){
for( i = 0; i < x.length; I++){
for(j = min; j <= max; j++){
if( x [i] != j){
newList.add( x[i] );
}
}
}
return newList;
}
}
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:
In CengageNOWv2, you may move, re-size, and rearrange panels in those assignments that use multiple panels.
Answer:
true
Explanation:
trust me lol, I promise it's correct.
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
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
}
5. All sites are required to have the following reference materials available for use at VITA/TCE sites in paper or electronic format: Publication 17, Publication 4012, Volunteer Tax Alerts (VTA), and Quality Site Requirement Alerts (QSRA). AARP Foundation Tax Aide uses CyberTax Alerts in lieu of VTAs and QSRAs. What other publication must be available at each site and contains information about the new security requirements at sites
Answer:
Publication 5140.
Explanation:
The acronym VITA stands for Volunteer Income Tax Assistance and TCE stands for Tax Counseling for the Elderly. VITA/TCE is a certification gotten from the Internal Revenue Service in which the holders of such certification are trained on how to help people that have disabilities or that their incomes earners that are low. These volunteers help these set of people to prepare for their tax return.
In order to make the volunteers to be able to perform their work with high accuracy, the Department of Treasury, Internal Revenue Service gave out some aids for Quality Site. One of the aids which is the one contains information about the new security requirements at sites is given in the Publication 5140.
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:
Write a program that will perform a few different String operations. The program must prompt for a name, and then tell the user how many letters are in the name, what the first letter of the name is, and what the last letter of the name is. It should then end with a goodbye message. A sample transcript of what your program should do is below:
Enter your name: Jeremy
Hello Jeremy!
Your name is 6 letters long.
Your name starts with a J.
Your name ends with a y.
Goodbye!
Answer:
Follows are the code to this question:
import java.util.*;//import package for user input
public class Main//defining a class Main
{
public static void main(String[] asp)//main method
{
String n;//defining String variable
Scanner oxr=new Scanner(System.in);//creating Scanner class Object
System.out.print("Enter your name: ");//print message
n=oxr.next();//input value
System.out.println("Hello "+n+"!");//print message with value
System.out.println("Your name is "+n.length()+" letters long.");//print message with value
System.out.println("Your name starts with a "+n.charAt(0)+".");//print message with value
System.out.println("Your name ends with a "+n.charAt(n.length()-1)+".");//print message with value
System.out.print("Goodbye!");//print message
}
}
Output:
Please find the attached file.
Explanation:
In the above-given code, A string variable "n" is declared, that uses the Scanner class object for input the value from the user-end.
In the next step, the multiple print method has used, which calculates the length, first and the last latter of the string value, and uses the print method to print the calculated value with the given message.
The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two preceding numbers. The first several numbers in the sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc. Write a function named fib that takes a positive integer parameter and returns the number at that position of the Fibonacci sequence. For example fib(1)
Answer:
In Python:
def fib(nterms):
n1, n2 = 1, 1
count = 0
while count < nterms:
term = n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
return term
Explanation:
This line defines the function
def fib(nterms):
This line initializes the first and second terms to 1
n1, n2 = 1, 1
This line initializes the Fibonacci count to 0
count = 0
The following while loops gets the number at the position of nterms
while count < nterms:
term = n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
This returns the Fibonnaci term
return term
Given that the variable named Boy = "Joey" and the variable named Age = 6, create statements that will output the following message:
Congratulations, Joey! Today you are 6 years old.
First, write one statement that will use a variable named Message to store the message. (You will need to concatenate all of the strings and variables together into the one variable named Message. If you don't know what that means, read the section in Chapter 1 about concatenation.)
Then write a second statement that will simply output the Message variable.
Answer:
isn't it already showing it if not put text box
Explanation:
instructions and programs data are stored in the same memory in which concept
Answer:
The term Stored Program Control Concept refers to the storage of instructions in computer memory to enable it to perform a variety of tasks in sequence or intermittently.
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