Input is greater than or equal to three. Example: INPUT: Enter array size: 7 Enter element 1: 1 Enter element 2: 5 Enter element 3: 2 Enter element 4: 3 Enter element 5: 9 Enter element 6: 0 Enter element 7: 4
Q: How many objects are created in the following code: public class RAM { int size; RAM(int size) {…
A: Object: Object is instance of class. It represent the real life entity. It is created by using the…
Q: 1. Write a c program that accepts a string from the user and outputs the length ( do not use any…
A: Step-1: StartStep-2: Declare two char array str[100]Step-3: Declare variable length=0Step-4: Take…
Q: What is the time complexity of the following code: int a = 0, b = 0; for (i = 0; i < N; i++) { a = a…
A: The solution is given below with proper explanation
Q: Ask yourself this: Is there anything that doesn't adhere to the principles of software engineering.…
A: Software Development: Software engineering is characterised as a methodical, disciplined, and…
Q: Do you have any ideas about email that you'd like to share? How does information go from one…
A: After drafting an email and pressing the send button, the message is sent to the Mail Transfer Agent…
Q: How to create a table in SQL?
A:
Q: I was wondering whether you were familiar with the software development process metrics. Every facet…
A: Introduction: In this question, we are asked about the software development process and the issue
Q: Using the primary key definitions from the 2NF and 3NF, order the generic definitions. Give a…
A: According to the information given:- We have to define using the primary key definitions from the…
Q: What ends does authentication work to achieve? Analyze the merits and drawbacks of various…
A: Authentication lets a server know who's accessing its data or site. Authentication is used when a…
Q: Give typed full explanation Don't upload any type of photos Define and explain the…
A: Solution : What Is a Fiduciary Responsibility : The relationship between a fiduciary and the…
Q: 23) What is mutual exclusion, what problem does it solve?
A: Mutual exclusion is a property of process synchronization which states that “no two processes can…
Q: Find the excess-3 code and its 9's complement for following decimal numbers. a) 592 b) 403
A:
Q: What is join in SQL?
A:
Q: Is it possible for one person to launch a DDoS attack?
A: When a victim is subjected to a distributed denial-of-service assault, often known as a DDoS attack,…
Q: I was wondering whether there were any real-world uses for discrete event simulation.
A: System functionality, inventory DES is often used to simulate planning/management, production…
Q: Since you already possess the benefit of having the program already built, using it is a breeze.
A: Here we have given a brief note on using a program that is already built. You can find the solution…
Q: What is Clock ? State its Use.
A:
Q: 1) print_header that simply prints the header for this program. This function does not return…
A: Function is a name given to a set of block of statements that is used for repeating task. Calling…
Q: injava please Assuming that the following classes have been defined: public class A { public static…
A: Java is an object oriented programming language.
Q: What are three benefits that can be provided by an intrusion detection system?
A:
Q: locations prone to collisions This Cisco switch command may be used to investigate issues with VLAN…
A: Introduction: Use the show interface trunk command to see if the peer-native and local VLANs are…
Q: Describe the programmers model.
A:
Q: Using the primary key definitions from the 2NF and 3NF, order the generic definitions. Give a…
A: Definitions from the 2NF and 3NF: Non-prime qualities may be functionally dependent in 2NF. In 3NF,…
Q: How about some guidelines for keeping data safe while using cloud services, including some examples?
A: What is security in the cloud: The software and practises used to manage and safeguard data stored…
Q: In your perspective, what place may screencasting play in technical writing? How do you believe it…
A: Screencast in Writing: A screencast records and narrates computer screen activity. It's a new method…
Q: What do you think is the most crucial part of software engineering?
A: Introduction The question concerns a major problem in the realm of software engineering, and the…
Q: To facilitate comprehension of the code, we use a variety of design techniques
A: Introduction Design Techniques:We use a spread of style ways to assist us higher comprehend the…
Q: What is the role of compression in the operation of a virus?
A:
Q: Discrete event simulation is important for four main reasons.
A: Introduction Give a thorough explanation of the relevance of continuous event simulation.
Q: lass with the following: In this class, create a Purchase Object after prompting the user for…
A: We need to define the Purchase class and Main class as per the given description.
Q: EXPLAIN ENCAPSULATION.
A: The answer to the question is given below:
Q: What are the applications of Morphing?
A:
Q: Consider the effects of PCs and the Internet on the evolution of system design to get a feel for the…
A: introduction: We must discuss the effects of two advancements on the evolution of system…
Q: How to delete a table in SQL?
A:
Q: In this problem, we are dealing with two dimensional arrays (or matrices) that have 10 rows and 10…
A: Answer: We have explain each and every point related to the given question in brief explanation.
Q: What services are provided by WSP?
A: The question has been answered in step2
Q: Given the array A . what are the two sub arrays generated after applying the partition procedure in…
A: The working structure of Quick Sort : Divide the array for the first time after choosing one…
Q: How to delete a row in SQL?'
A: SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Q: Explain the Decimal Number system?
A: Number System: Basically the number system is considered the notation of numbers by using digits .…
Q: CONVERT THE CODE TO JAVA: #include using namespace std; int main(void) { char input;…
A: Please find the answer below :
Q: 7. IMPLEMENTATION OF PAGE REPLACEMENT ALGORITHMS c) OPTIMAL PAGE REPLACEMENT ALGORITHM
A: When a new page is referred to in an operating system and it is not present in memory, a page fault…
Q: During the process of learning a new programming language, two of the subjects/activities that are…
A: Syntax Basics Structures and Forms of Data Structures for Flow Management (Conditionals and loops)…
Q: Explain Polymorphism.
A: The solution is given below with code examples
Q: What distinguishes the two different kinds of integrity restrictions from one another?
A: Basics: Structured Query Language, or SQL. It enables you to access and manage information bases…
Q: True or False In Open Flow the control plane stays on the device whereas the data plane moves to…
A: The control plane lies above the data plane. Data plane lies in the device and control plane moves…
Q: List and briefly define four techniques used to avoid guessable passwords.
A: Introduction: Four techniques are used to avoid guessable passwords. Make use of a combination of…
Q: Define Sequential Logic Circuit.
A: Solution : Define Sequential Logic Circuit : A sequential circuit is a subtype of a circuit. It is…
Q: Displaying the hash of a file on a website in order to provide data integrity relies only on the…
A: Displaying the hash of a file on a website in order to provide data integrity relies only on the pre…
Q: Consider the effects of PCs and the Internet on the evolution of system design to get a feel for the…
A: We must discuss the effects of two advancements on the evolution of system architecture: Effects of…
Q: Explain how one person can pull off a DDoS assault.
A: DDoS Attack: A distributed denial-of-service (DDoS) attack floods a server, service, or network with…
JAVA PROGRAM
Create a program that accepts a positive odd integer input then create an integer array with a size equal to the inputted number.
Using loops, add integer values into the array by asking for a user input repeatedly until the last allocable index of the array.
Traverse the array and print the element.
Note:
- Input should be positive odd number.
- Input is greater than or equal to three.
Example:
INPUT:
Enter array size: 7
Enter element 1: 1
Enter element 2: 5
Enter element 3: 2
Enter element 4: 3
Enter element 5: 9
Enter element 6: 0
Enter element 7: 4
OUPUT:
{1, 5, 2, 3, 9, 0, 4}
Step by step
Solved in 4 steps with 2 images
- Write a Java program to find all triplets (three numbers whose sum equal a given sum (16) from an unsorted array of integers. Read the text file (“triplets.txt”) into an array. This file has 14 rows. Then find all of the combinations of three numbers that sum to 16. Use a main method to read in the data to an array and a second method that will use nested loops to count the numbers of triplets. Your output should look like the following: Original array: [1, 6, 3, 0, 8, 4, 7, 5, 2, 11, 9, 14, 15, 10] Triplets of sum 16 (0 1 15) (0 2 14) (0 5 11) (0 6 10) (0 7 9) (1 4 11) (1 5 10) (1 6 9) (1 7 8) (2 3 11) (2 4 10) (2 5 9) (2 6 8) (3 4 9) (3 5 8) (3 6 7) (4 5 7) Triplets.txt 163084752119141510write a java program: You have been given two random integer arrays as arr1 and arr2 of size n and m respectively. Boththe arrays contain numbers from 0 to 9 (i.e. single digit integer is present at every index). The ideahere is to represent each array as an integer in itself of digits n and m.You need to find the sum of both the input arrays treating them as two integers and put the result inanother array i.e. output array will also contain only single digit at every index.Input Format:Line 1: Size of first arrayLine 2: Elements of first arrayLine 3: Size of second arrayLine 4: Elements of second arrayOutput Format:The resultant arraySample Input 1:36 2 437 5 6Sample Output 1:1 3 8 0Sample Input 2:49 7 6 134 5 9Sample Output 2:1 0 2 2 0Write a program in Java that reads integers, one per line, and displays their sum. Also, display all the numbers read, each with an annotation giving its percentage contribution to the sum. Use a method that takes the entire array as one argument and returns the sum of the numbers in the array. (Hint: Ask the user for the number of integers to be entered, create an array of that length, and then fill the array with the integers read.
- Write a java code that computes the alternating sum of all the elements in an array. For example, if your program has an array with these elements. 1 4 9 16 9 7 4 9 11 It will compute: 1 - 4 + 9 - 16 + 9 - 7 + 4 - 9 + 11 = -2IN JAVA Given an array, write a program to print the array elements one by one in a new line. If the array element is divisible by 4, print Four. If it is divisible by 6, print Six. If it is divisible by both 4 and 6, print Four Six. Use the following input array Int[] input_array = {2, 5, 10, 8, 18, 24, 3, 48, 30, 9, 12} Output should be 2 5 10 Four Six Four Six 3 Four Six Six 9 Four SixWrite a Java program with a single-dimension array that holds 10 integer numbers and identify the maximum value of the 10 numbers. Next sort the array using a bubble sort and display the array before and after sorting. Psuedocode Generate 10 random integer numbers between 1 and 100 place each random number in a different element of a single-dimension array Display the array's contents unsorted as they are generated Using the bubble sort, sort the array from smallest integer to the largest. //must use the following: Bubble Sort Code: public static void bubbleSort(int[] list) { int temp; for (int i = list.length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (list[j] > list[j + 1]) { temp = list[j]; list[j] = list[j + 1]; list[j + 1] = temp; }…
- (in Java language) Write a method that is inspired by a photo app that does the following. Ask the user to enter a size of array between 2 to 10. Based on the size entered, write a loop which asks the user to fill values into an integer array. Print the array contents using Arrays.toString(). For this integer array, write a logic that returns true if there exists a place to split the array such that the sum of the numbers on one side is equal to the sum of the numbers on the other. Otherwise return false. Examples: If the array is {1, 1, 1, 2, 1} then return true. If the array is {2, 1, 1, 2, 1} then return false If the array is {10, 10} then return true.Write a Java program that creates an array data of size 8, representing a binary number of 8 bits. The user must fill/enter the elements of this array only by inputting 0 or 1. If the user enters any different number, the program must display “Invalid data” message. If all entered digits are valid binary digits, the program must calculate and output the special decimal number represented by this binary number as shown in the below example: If the array data is 1 | 0 | 1 1 0 0 0 0 Result=1X2°+ 0X2'+ 1X2%+ 1X2'+ 0X2'+ 0X2°+ 0X2°+ 0X2 Result = 1 L3 0 + 4 + 8 + 0 + 0 + 0 + 0 = 13 Then the result is calculated by multiplying the value of the data array at each index with the result of 21 then adding all the answers. (shown in the above example) Sample runl: Enter the digits consisting of (0s or 1s): 2 5413257 Invalid data Sample run2: Enter the digits consisting of (0s or 1s): 1 111000 2 Invalid data Sample run3: Enter the digits consisting of (0s or 1s): 11110000 The number in decimal is…Computer Science In java, use while (!StdIn.isEmpty()) to read in a file of strings with 3 letter words. put these strings into an array and choose one word from the array at random. Ask the user to guess the string. If they get it wrong, give them one of the letters, then let them guess again. Keep going until they get the correct answer. then output "Good job, you guessed my word!"
- Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 2 4 6 8 10 the output is: 10 8 6 4 2 To achieve the above, first read the integers into an array. Then output the array in reverse. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] userList = new int[20]; // List of numElement integers specified by the user int numElements; // Number of integers in user's list// Add more variables as needed numElements = scnr.nextInt(); // Input begins with number of integers that follow/* Type your code here. */}}(IN JAVA) Write a method which does the following: Ask the user to enter a size of array between 2 to 10. Based on the size entered, write a loop which asks the user to fill values into an integer array. Print the array contents using Arrays.toString(). For this integer array, write a logic that returns true if there exists a place to split the array such that the sum of the numbers on one side is equal to the sum of the numbers on the other. Otherwise return false. Examples: If the array is {1, 1, 1, 2, 1} then return true. If the array is {2, 1, 1, 2, 1} then return false If the array is {10, 10} then return true.Write a program that declares an array of 15 integers and reads the values from the user. Make sure that the user doesn’t enter a value greater than 10 (if the user enters a value not in the allowed range, discard that value and read another to put into the array). Now tell the number that occur maximum number of times in the array. For example for the following 7 has maximum occurrence. 4,7,3,3,2,7,1,5,7,9,9,9,7,8,10 Use both linear and binary search.