LAB: Output values below an amount - methods
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75
For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. Write your code to define and use two methods: public static void getUserValues(int[] myArr, int arrSize, Scanner scnr) public static void outputIntsLessThanorEqualToThreshold (int[] userValues, int userValsSize, int upperThreshold) Utilizing methods will help to make main() very clean and intuitive.
Answer:
The program in Java is as follows:
import java.util.*;
public class Main{
public static void getUs erValues(int[ ] myArr, int arr Size, Scanner scnr){
for(int i = 0; i<arrSize;i++){
myArr[i] = scnr.nextInt(); }
outputIntsLessThanorEqualToThreshold (myArr, arrSize, myArr[arrSize-1]);
}
public static void outputIntsLessThanorEqualToThreshold (int[] userValues, int userValsSize, int upperThreshold){
for(int i = 0; i<=userValsSize;i++){
if(userValues[i]<upperThreshold){
System.out.print(userValues[i]+" "); } }
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int n;
n = scnr.nextInt();
int [] myArr = new int[n];
getUserValues(myArr,n,scnr); }
}
Explanation:
See attachment for complete program where comments are used to explain each line
Create an application containing an array that stores eight integers. The application should call five methods that in turn:
Display all the integers
Display all the integers in reverse order
Display the sum of the integers
Display all values less than a limiting argument
Display all values that are higher than the calculated average value.
public class ArrayMethodDemo {
public static void main (String args[]) {
int[] numbers = {12, 15, 34, 67, 4, 9, 10, 7};
int limit = 12;
display(numbers);
displayReverse(numbers);
displaySum(numbers);
displayLessThan(numbers, limit);
displayHigherThanAverage(numbers);
}
public static void display(int[] numbers) {
// Write your code here
}
public static void displayReverse(int[] numbers) {
// Write your code here
}
public static void displaySum(int[] numbers) {
// Write your code here
}
public static void displayLessThan(int[] numbers, int limit) {
// Write your code here
}
public static void displayHigherThanAverage(int[] numbers) {
// Write your code here
}
}
public class ArrayMethodDemo {
public static void main (String args[]) {
int[] numbers = {12, 15, 34, 67, 4, 9, 10, 7};
int limit = 12;
display(numbers);
displayReverse(numbers);
displaySum(numbers);
displayLessThan(numbers, limit);
displayHigherThanAverage(numbers);
}
public static void display(int[] numbers) {
//Message to be displayed before printing out the numbers
System.out.print("Numbers in the array: ");
//loop through the numbers in the array and print each number
for(int x: numbers){
System.out.print(x + " ");
}
//print a new line
System.out.println();
}
public static void displayReverse(int[] numbers) {
//Message to be displayed before printing out the reverse of the array
System.out.print("Reverse of the array numbers: ");
//loop through the array starting from the last index
for(int i = numbers.length - 1; i > 0; i--){
System.out.print(numbers[i] + " ");
}
//print a new line
System.out.println();
}
public static void displaySum(int[] numbers) {
//initialize the sum variable
int sum = 0;
//loop through the array and add each element to sum
for(int i = 0; i < numbers.length; i++){
sum += numbers[i];
}
//print out the sum
System.out.println("Sum: " + sum);
}
public static void displayLessThan(int[] numbers, int limit) {
//Text to be displayed before printing values less than the limit
System.out.print("Values less than limit (" + limit + "): ");
//loop through the array and print numbers lower than the specified limit
for(int i = 0; i < numbers.length; i++){
if(numbers[i] < limit){
System.out.print(numbers[i] + " ");
}
}
//print a new line
System.out.println();
}
public static void displayHigherThanAverage(int[] numbers) {
//initialize the average variable
double average = 0.0;
//initialize the sum variable
int sum = 0;
//loop through the array and add each element to sum
for(int i = 0; i < numbers.length; i++){
sum += numbers[i];
}
//calculate the average
average = sum / numbers.length;
//Message to be displayed before printing the values higher than the average
System.out.print("Values higher than average (" + average + "): ");
//loop through the array and print numbers higher than the calculated average
for(int i = 0; i < numbers.length; i++){
if(numbers[i] > average){
System.out.print(numbers[i] + " ");
}
}
//print a new line
System.out.println();
}
}
Sample Output:
Numbers in the array: 12 15 34 67 4 9 10 7
Reverse of the array numbers: 7 10 9 4 67 34 15
Sum: 158
Values less than limit (12): 4 9 10 7
Values higher than average(19.0):34 67
Explanation:The code above contains comments explaining important parts of the code. Kindly go through the comments. A sample output, arising from running the application, has also been added to ace understandability.
Manny has drafted an email message and configured a delivery option "Do not deliver before: 5:00 P.M. and today's date." He shuts down his computer and leaves for the day at 4:30 p.m. What will happen at 5 p.m.?
Answer:
The Email will send.
Explanation:
The email will send as long as there is internet connection.
Answer: this isnt an answer but i really need ur help.. did u pass the microsoft unit test? I cant pass it if my life depended on it
Explanation:
Its on edge
Which company provides a crowdsourcing platform for corporate research and development?
OA.
MTurk
OB.
WikiAnswers
O C.
MediaWiki
OD.
Innocentive
Answer:
OA.
MTurk(mechanical turk)
Explanation:
Mechanical Turk is a Microwork service provided by Amazon. Correct answer: C It is an online “crowdsourcing” marketplace that was launched in 2005 by Amazon.
This site (service) allows businesses and individuals to post short tasks and pay workers to complete them.
Mechanical Turk is a company that provides a crowdsourcing platform for corporate research and development.
What is Mechanical Turk?Mechanical Turk is a crowdsourcing platform that gather information and makes it possible for individuals and businesses to outsource jobs to people who have the ability to do the task online or virtually. These can include data entry, reasearch, survey participation and so on. to a distributed workforce who can perform these tasks virtually.
Crowdsourcing is a platform that gather information about jobs and service provider online.
Therefore, Mechanical Turk is a company that provides a crowdsourcing platform for corporate research and development.
Learn more of Crowdsourcing from the link below.
https://brainly.com/question/1788104.
What is needed to broadcast a presentation on the internet using PowerPoint’s online service?
Answer:
a Microsoft account
Explanation:
Answer:
Its B
a Microsoft account
Explanation:
Pathways in the Science, Technology, Engineering, & Mathematics Career Cluster include:
engineering and technology
banking services
science and mathematics
foreign service
Answer: wanna say engineering technology and science and mathematics
Explanation:
Answer:
engineering and technology ; science and mathematics
Explanation:
What symbol next to the records indicates that a table includes a subdatasheet? an asterisk a plus sign a question mark an exclamation point
Answer:
A plus sign
Explanation:
EDGE 2021
Answer: or in other words B
Explanation: on edg hop this helps
What is the definition of personality? Your talents and skills The way you prefer to think and act The things that make you unique The jobs at which you will be good
Answer:
The things that make you unique.
Explanation:
Personality can be defined as a unique blend of various characteristics or traits such as mental, physical, emotional and social with respect to an individual. Thus, these characteristics, qualities or traits influences the way a person acts, thinks, feel and behave in relation with their environment and others.
Some of the factors that influence the personality of a person includes the following;
I. Hereditary.
II. Environment.
III. Culture.
IV. Family background.
Hence, the definition of personality would be the things that make an individual or a person unique.
This ultimately implies that, a person's personality is unique to him or her and as such differentiates them entirely from another person based on thought, emotional and behavioral patterns.
Furthermore, the four types of personality are;
1. Driver personality.
2. Amiable personality.
3. Expressive personality.
4. Analytical personality.
Answer: The way you prefer to think and act
Explanation:aaaaaaaaaaAAAAAAAAAAAAAAAAA
Walt needs to ensure that messages from colleague in another organization are never incorrectly identified as spam. What should he do?
- configure a safe recipient
- configure a blocked sender
- configure a safe sender
- do nothing
Answer:
Configure a safe sender.
Explanation:
Spam is a computer term that designates unwanted messages in an email, as well as advertising messages on websites. The main characteristic of these messages is that they do not respond to any previous action on the part of the receiver, such as a conversation with the sender or an advertisement that arises from search engine algorithms, but is sent randomly by an anonymous sender with objectives that are not entirely clear or legitimate.
Therefore, if Walt wishes that his colleague's messages are not classified as spam, he must categorize this person as a safe sender within his email box.
-1
Draw a flowchart to input two
numbers in variables M and N and
print the multiplication table from 1*1
to M*N
Answer:A flowchart is a diagram that depicts the steps involved in solving a problem. The following flowchart shows how to output the multiplication table ( n * 1 to m * 1) of a number, n and m:
How does it transform your ways of socializing
How to transform your ways of socializing:
Know Yourself. The first and foremost reason why many people fail in effective socializing is the fact that they don’t know themselves well.
Be yourself. Another reason of failing to socialize or failing to make that “first impression” is that we try to mimic others.
Body Language. The way you walk, stand, talk, eat and sit… Each and every gesture and posture of yours speaks volumes about you.
Your attire. I had a client who had severe social anxiety. It was aggravated when her mother forced her to wear stuff that was too body revealing.
etc.
This was written from a biography about someones experience.
_____________________________
Brainliest would be greatly appreciated.
I found this!
______________________________
#SpreadTheLove
#SaveTheTrees
Where does your father go every morning?
Answer:
work
Explanation:
it's depends if you have a father because if you don't, that means he is with is other son/daughter.
A project team using a linear, sequential model builds a software application over a long duration. All activities in the project are carried out one after the other. Once the product is tested, the team installs the application. Which phase of this model involves installation?
A.
system design
B.
coding
C.
deployment
D.
requirements gathering
E.
testing
Answer:
C. Deployment
Explanation:
Deployment is the phase at which the product is installed after testing.
Use the drop-down menus to explain how to set up a lookup field to use a combo box control with a list of options. 1. Open a table in Design view, and right-click a field. 2. Select Change To in the drop-down menu, then select . 3. On the Data tab of the , make a number of choices. 4. For the Row Source Type, choose . 5. For Limit to List, select . 6. For Row Source, click the ellipsis and enter the values in the dialog box that opens. 7. Close the Property Sheet, and save the form.
Answer:
Combo Box, Property Sheet, Value List, Yes
Explanation:
Use the drop-down menus to explain how to set up a lookup field to use a combo box control with a list of options are the combo box, vause lkist.
What is the distinction between a mixture container and a drop-down listing?A drop-down listing is a listing wherein the chosen object is constantly seen, and the others are seen on call for via way of means of clicking a drop-down button. A combo container is a mixture of a listing container or a drop-down listing and an editable textual content container, as a consequence permitting customers to go into a fee that isn't always withinside the listing.
A drop-down listing in Access 2013 gives a listing of values to useful resources in statistics access in tables or forms. Although you could permit customers to manually input values that do not exist withinside the drop-down listing, you will want to disable this selection to limition alternatives to tiered values.
Read more about the combo box control:
https://brainly.com/question/17238933
#SPJ2
Sorting Records in a Form
Use the drop-down menus to complete the steps for sorting records in a form.
1. Open the form in the standard form view.
2. Put the cursor in the
to use for sorting.
3. Open the
4. In the Sort & Filter group, click
v tab.
Answer:
1. Open the form in the standard form view.
2. Put the cursor in the field to use for sorting.
3. Open the Home tab
4. In the Sort & Filter group, click ascending or descending
Explanation:
Took the test :)
The complete forum to complete the steps for sorting records in a form is discussed below:
What do you mean by speed records?You can specify the order of the records that are returned for each navigation query by sorting. It can be adjusted either globally or for each query. You can specify the number of characteristics and the ascending or descending order of pairs of values when submitting a simple navigation request.
Launch the default form view by opening the form.
2. Position the cursor within the field you want to sort.
3. Click on the Home tab.
4. Select either ascending or descending in the Sort & Filter group.
Learn more about sorting records here:
https://brainly.com/question/13130958
#SPJ1
Which is the least technically experienced technical support group?
O tier 2 support
tier 3 support
multi-channel support model
tier 1 support
Answer:
Tier 1 support
Explanation:
Of the given options, tier 1 support technical group is the least experienced group. This group of technicians is also referred to as level 1 technical group.
The tier 1 or level support are made up of junior technician, and they have few technical understandings.
Their roles include email response and basic troubleshooting, attending to phone calls, among others.
When a problem cannot be solved by tier 1 support technicians, they pass the problem to tier 2 support technicians,
Which of the following protocols help IP in multicast service?
Select one:
ORARP
O CMP
O ARP
O IGMP
Answer:
I guess IGMP.............
Answer:
IGMP
Explanation:
The correct answer is actually IGMP snooping.
so from your options it's IGMP
are you interested in cyber security?
You created a database related to computer hardware parts and their details. You'd like to view the names of the parts in alphabetical order. Which database operation can you use to view the desired output ?
(type correct answer in text box)
The ( ) operation will allow you to view the names of the parts in alphabetical order.
Answer:
The sorting operation
Explanation:
Required
Database operation to view a record in alphabetical order
The operation is sorting.
Literally, this means arranging data in a particular order (e.g. ascending or descending order)
So, after the database has been created, and I need to the arranged list of names of the computer hardware, I will make use of the sorting operation.
Depending on the database management software that I used, the operation can be achieved using SQL queries (e.g. MySQL Workbench) and can also be done manually (e.g. Microsoft Office Access)
requires the receiver to guess the message by
using redundant bits.
Select one
O Forward error correction
OPanity check
ORetransmission
OBlock rolina
Answer:
Forward error correction requires the receiver to guess the message by using redundant bits.
hope it is helpful to you
Answer:
forward error correction
is the first one
Factory Design Pattern Assignment This assignment will give you practice in using the Factory/Abstract Factory Design Pattern. You are going to create a Terraforming program. What does terraform mean
Answer:
Terraform is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.
__' the low level language? a.machine and assembly c.3G and 4G d.machine and 4gl
Answer:
a. machine and assembly.
Explanation:
An instruction set architecture (ISA) can be defined as series of native memory architecture, instructions, addressing modes, external input and output devices, virtual memory, and interrupts that are meant to be executed by the directly.
Basically, this set of native data type specifies a well-defined interface for the development of the hardware and the software platform to run it.
A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer how to perform a specific task and to solve a particular problem.
Machine and assembly are referred to as the low level programming language used in writing software programs or applications with respect to computer hardware and architecture. Machine language is generally written in 0s and 1s, and as such are cryptic in nature, making them unreadable by humans. Also, assembly language use commands written in English such as SUB, MOV, ADD, etc.
On the other hand, a high level language can be defined as a programming language which is generally less complex than a machine (low level) language and easy to understand by the end users (programmers).
This ultimately implies that, a high level programming language is typically a user friendly language and as such simplifies coding or programming for beginners.
Some examples of high level programming language are Python, Java, C#, Ruby, Perl, Visual Basic, PHP, Cobol, C++, Fortran, Javascript, etc.
Select the best ansiver for each question below
c. Linux
c. operational interference
2. What type of software works with users, application software, and computer hardware
handle the majority of technical details?
a Application
b. Desktop
d. system
The ability to switch between different applications stored in memory is called
a Diversion
b. Multitasking
d. programming
Graphic representations for a program, type of file, ar function:
a. App
e image
b. Icon
d. software
The operating system based on Linux, designed for Netbook computers, and focused on
Internet connectivity through cloud computing:
a Chrome
c. Unix
b. Mac
d. Windows
Programs that coordinate computer resources, provide an interface, and run applicatio
Answer:
the answer is going to be system
write the C program
The function turn_to_letter decides on the letter grade of the student according to the table below from the visa and final grades sent into it and returns it, write it together with a main function which the turn_to_letter function is called and prints the letter equivalent on the screen. -Success score = 40% of midterm + 60% of final,
-F for the success score below 50, D for between 50 and 59, C for between 60 and 69, B for between 70 and 79, A for 80 and above.
Answer:
The program in C is as follows:
#include <stdio.h>
char turn_to_letter(double score){
char lettergrade = 'A';
if(score>=80){ lettergrade = 'A'; }
else if(score>=70){ lettergrade = 'B'; }
else if(score>=60){ lettergrade = 'C'; }
else if(score>=50){ lettergrade = 'D'; }
else{lettergrade = 'F';}
return lettergrade;
}
int main(){
int midterm, final;
double score;
printf("Midterm: "); scanf("%d", &midterm);
printf("Final: "); scanf("%d", &final);
score = 0.4 * midterm + 0.6 * final;
printf("Score: %lf\n", score);
printf("Letter Grade: %c",turn_to_letter(score));
return 0;
}
Explanation:
The function begins here
char turn_to_letter(double score){
This initializes lettergrade to A
char lettergrade = 'A';
For scores above or equal to 80, grade is A
if(score>=80){ lettergrade = 'A'; }
For scores above or equal to 70, grade is B
else if(score>=70){ lettergrade = 'B'; }
For scores above or equal to 60, grade is C
else if(score>=60){ lettergrade = 'C'; }
For scores above or equal to 50, grade is D
else if(score>=50){ lettergrade = 'D'; }
Grade is F for other scores
else{lettergrade = 'F';}
This returns the letter grade
return lettergrade;
}
The main begins here
int main(){
This declares the midterm and final scores as integer
int midterm, final;
This declares the total score as double
double score;
These get input for midterm score
printf("Midterm: "); scanf("%d", &midterm);
These get input for final score
printf("Final: "); scanf("%d", &final);
This calculates the total score
score = 0.4 * midterm + 0.6 * final;
This prints the calculated total score
printf("Score: %lf\n", score);
This calls the turn_to_letter function and prints the returned letter grade
printf("Letter Grade: %c",turn_to_letter(score));
return 0;
}
answer any one: write a computer program:
Answer:
hope this helps you look it once
Write a program that prompts the user to enter an oligonucleotide sequence, such as TATGAGCCCGTA.
If the user entered a valid oligo sequence consisting only of the characters A, C, G, or T, the program should then display the reverse complement of that sequence, in this case TACGGGCTCATA, along with text indicating that it is the reverse complement .
After displaying the reverse complement, the program should then prompt the user to enter another sequence. The program should continue this pattern of prompting the user for a new oligo sequence and displaying its reverse complement until the user enters a sequence with at least one character that is invalid (i.e. a character other than A, C, G, or T).
Answer:
Explanation:
The following code is written in Python. It continues looping and asking the user for an oligonucleotide sequence and as long as it is valid it outputs the reverse complement of the sequence. Otherwise it exits the loop
letters = {'A', 'C', 'G', 'T'}
reloop = True
while reloop:
sequence = input("Enter oligonucleotide sequence: ")
for x in sequence:
if x not in letters:
reloop = False;
break
if reloop == False:
break
newSequence = ""
for x in sequence:
if x == 'A':
newSequence += 'T'
elif x == 'T':
newSequence += 'A'
elif x == 'C':
newSequence += 'G'
elif x == 'G':
newSequence += 'C'
print("Reverse Complement: " + newSequence)
Good safety with the use of cellphones
Answer:
what kind of question is this ?
What is the role of science and technology in achieving human’s ultimate goal or the good life?
Answer:
The role that science and technology has played in improving the life conditions across the globe is vivid, but the benefit has to been harvested maximum by all countries. Hope This Helps!
Explanation:
Which work habits should you follow to increase work efficiency and avoid health issues?
Answer:
Just get good sleep, eat breakfast, and exercise.
Answer:
take periodic breaks and alternate between tasks
Dante needs to query a table to find all the references to a particular product and apply a 10%
discount. Which query should he utilize?
O make table query
O delete query
O update query
O append query
Answer:
update query
I hope this helps a little bit.
Answer:
update query
Explanation:
took the test
Which statement creates a StudentIDs object given the following code: public class StudentIDs> { private TheType item1; private TheType item2; public StudentIDs(TheType i1, TheType i2) { item1 = i1; item2 = i2; } }
a. StudentIDs newStudent = new StudentIDs(9, 5);
b. StudentIDs newStudent = new StudentIDs (Integer iVal1, Integer iVal2);
c. StudentIDs newStudent = new StudentIDs(int iVal1, int iVal2);
d. StudentIDs newStudent = new StudentIDs(9, 5);
Answer:
StudentIDs<TheType> newStudent = new StudentIDs<TheType>(9,5);
Explanation:
Required
Which statement creates a studentIDs object
The question has conflicting details as none of the options is true because some definitions that do not appear in the options.
So, I will answer the question based on the definition in the question.
From the question, we have the class definition to be:
public class StudentIDs<TheType extends Comparable<TheType>>
The above definition is a simple generic java class that follows:
public class Class-Name<Variable-name extends Comparable<Variable-name>>
The object of the class will be created using the following syntax:
Class-Name<TheType> Object-Name = new Class-Name<TheType>();
By comparison:
Class-Name = StudentIDs
Variable-name = TheType
So, the object will be defined as:
StudentIDs<TheType> newStudent = new StudentIDs<TheType>();
Solving further:
The class declares two variables (i1 and i2) as follows:
public StudentIDs(TheType i1, TheType i2)
This means that two TheType variables and/or values will be passed along with the definition of the class.
So, the object definition will be:
StudentIDs<TheType> newStudent = new StudentIDs<TheType>(9,5);